/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.6.4
 * Contact: hello@goauthentik.io
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { mapValues } from '../runtime';
import type { CountryCodeEnum } from './CountryCodeEnum';
import {
    CountryCodeEnumFromJSON,
    CountryCodeEnumFromJSONTyped,
    CountryCodeEnumToJSON,
    CountryCodeEnumToJSONTyped,
} from './CountryCodeEnum';

/**
 * GeoIP Policy Serializer
 * @export
 * @interface PatchedGeoIPPolicyRequest
 */
export interface PatchedGeoIPPolicyRequest {
    /**
     * 
     * @type {string}
     * @memberof PatchedGeoIPPolicyRequest
     */
    name?: string;
    /**
     * When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.
     * @type {boolean}
     * @memberof PatchedGeoIPPolicyRequest
     */
    executionLogging?: boolean;
    /**
     * 
     * @type {Array<number>}
     * @memberof PatchedGeoIPPolicyRequest
     */
    asns?: Array<number>;
    /**
     * 
     * @type {Array<CountryCodeEnum>}
     * @memberof PatchedGeoIPPolicyRequest
     */
    countries?: Array<CountryCodeEnum>;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedGeoIPPolicyRequest
     */
    checkHistoryDistance?: boolean;
    /**
     * 
     * @type {number}
     * @memberof PatchedGeoIPPolicyRequest
     */
    historyMaxDistanceKm?: number;
    /**
     * 
     * @type {number}
     * @memberof PatchedGeoIPPolicyRequest
     */
    distanceToleranceKm?: number;
    /**
     * 
     * @type {number}
     * @memberof PatchedGeoIPPolicyRequest
     */
    historyLoginCount?: number;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedGeoIPPolicyRequest
     */
    checkImpossibleTravel?: boolean;
    /**
     * 
     * @type {number}
     * @memberof PatchedGeoIPPolicyRequest
     */
    impossibleToleranceKm?: number;
}

/**
 * Check if a given object implements the PatchedGeoIPPolicyRequest interface.
 */
export function instanceOfPatchedGeoIPPolicyRequest(value: object): value is PatchedGeoIPPolicyRequest {
    return true;
}

export function PatchedGeoIPPolicyRequestFromJSON(json: any): PatchedGeoIPPolicyRequest {
    return PatchedGeoIPPolicyRequestFromJSONTyped(json, false);
}

export function PatchedGeoIPPolicyRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedGeoIPPolicyRequest {
    if (json == null) {
        return json;
    }
    return {
        
        'name': json['name'] == null ? undefined : json['name'],
        'executionLogging': json['execution_logging'] == null ? undefined : json['execution_logging'],
        'asns': json['asns'] == null ? undefined : json['asns'],
        'countries': json['countries'] == null ? undefined : ((json['countries'] as Array<any>).map(CountryCodeEnumFromJSON)),
        'checkHistoryDistance': json['check_history_distance'] == null ? undefined : json['check_history_distance'],
        'historyMaxDistanceKm': json['history_max_distance_km'] == null ? undefined : json['history_max_distance_km'],
        'distanceToleranceKm': json['distance_tolerance_km'] == null ? undefined : json['distance_tolerance_km'],
        'historyLoginCount': json['history_login_count'] == null ? undefined : json['history_login_count'],
        'checkImpossibleTravel': json['check_impossible_travel'] == null ? undefined : json['check_impossible_travel'],
        'impossibleToleranceKm': json['impossible_tolerance_km'] == null ? undefined : json['impossible_tolerance_km'],
    };
}

export function PatchedGeoIPPolicyRequestToJSON(json: any): PatchedGeoIPPolicyRequest {
    return PatchedGeoIPPolicyRequestToJSONTyped(json, false);
}

export function PatchedGeoIPPolicyRequestToJSONTyped(value?: PatchedGeoIPPolicyRequest | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'execution_logging': value['executionLogging'],
        'asns': value['asns'],
        'countries': value['countries'] == null ? undefined : ((value['countries'] as Array<any>).map(CountryCodeEnumToJSON)),
        'check_history_distance': value['checkHistoryDistance'],
        'history_max_distance_km': value['historyMaxDistanceKm'],
        'distance_tolerance_km': value['distanceToleranceKm'],
        'history_login_count': value['historyLoginCount'],
        'check_impossible_travel': value['checkImpossibleTravel'],
        'impossible_tolerance_km': value['impossibleToleranceKm'],
    };
}

