/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.0-rc1
 * 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 { LDAPAPIAccessMode } from './LDAPAPIAccessMode';
import {
    LDAPAPIAccessModeFromJSON,
    LDAPAPIAccessModeFromJSONTyped,
    LDAPAPIAccessModeToJSON,
    LDAPAPIAccessModeToJSONTyped,
} from './LDAPAPIAccessMode';

/**
 * LDAPProvider Serializer
 * @export
 * @interface LDAPOutpostConfig
 */
export interface LDAPOutpostConfig {
    /**
     * 
     * @type {number}
     * @memberof LDAPOutpostConfig
     */
    readonly pk: number;
    /**
     * 
     * @type {string}
     * @memberof LDAPOutpostConfig
     */
    name: string;
    /**
     * DN under which objects are accessible.
     * @type {string}
     * @memberof LDAPOutpostConfig
     */
    baseDn?: string;
    /**
     * 
     * @type {string}
     * @memberof LDAPOutpostConfig
     */
    bindFlowSlug: string;
    /**
     * Get slug for unbind flow, defaulting to brand's default flow.
     * @type {string}
     * @memberof LDAPOutpostConfig
     */
    readonly unbindFlowSlug: string | null;
    /**
     * Prioritise backchannel slug over direct application slug
     * @type {string}
     * @memberof LDAPOutpostConfig
     */
    readonly applicationSlug: string;
    /**
     * 
     * @type {string}
     * @memberof LDAPOutpostConfig
     */
    certificate?: string | null;
    /**
     * 
     * @type {string}
     * @memberof LDAPOutpostConfig
     */
    tlsServerName?: string;
    /**
     * The start for uidNumbers, this number is added to the user.pk to make sure that the numbers aren't too low for POSIX users. Default is 2000 to ensure that we don't collide with local users uidNumber
     * @type {number}
     * @memberof LDAPOutpostConfig
     */
    uidStartNumber?: number;
    /**
     * The start for gidNumbers, this number is added to a number generated from the group.pk to make sure that the numbers aren't too low for POSIX groups. Default is 4000 to ensure that we don't collide with local groups or users primary groups gidNumber
     * @type {number}
     * @memberof LDAPOutpostConfig
     */
    gidStartNumber?: number;
    /**
     * 
     * @type {LDAPAPIAccessMode}
     * @memberof LDAPOutpostConfig
     */
    searchMode?: LDAPAPIAccessMode;
    /**
     * 
     * @type {LDAPAPIAccessMode}
     * @memberof LDAPOutpostConfig
     */
    bindMode?: LDAPAPIAccessMode;
    /**
     * When enabled, code-based multi-factor authentication can be used by appending a semicolon and the TOTP code to the password. This should only be enabled if all users that will bind to this provider have a TOTP device configured, as otherwise a password may incorrectly be rejected if it contains a semicolon.
     * @type {boolean}
     * @memberof LDAPOutpostConfig
     */
    mfaSupport?: boolean;
}



/**
 * Check if a given object implements the LDAPOutpostConfig interface.
 */
export function instanceOfLDAPOutpostConfig(value: object): value is LDAPOutpostConfig {
    if (!('pk' in value) || value['pk'] === undefined) return false;
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('bindFlowSlug' in value) || value['bindFlowSlug'] === undefined) return false;
    if (!('unbindFlowSlug' in value) || value['unbindFlowSlug'] === undefined) return false;
    if (!('applicationSlug' in value) || value['applicationSlug'] === undefined) return false;
    return true;
}

export function LDAPOutpostConfigFromJSON(json: any): LDAPOutpostConfig {
    return LDAPOutpostConfigFromJSONTyped(json, false);
}

export function LDAPOutpostConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): LDAPOutpostConfig {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'name': json['name'],
        'baseDn': json['base_dn'] == null ? undefined : json['base_dn'],
        'bindFlowSlug': json['bind_flow_slug'],
        'unbindFlowSlug': json['unbind_flow_slug'],
        'applicationSlug': json['application_slug'],
        'certificate': json['certificate'] == null ? undefined : json['certificate'],
        'tlsServerName': json['tls_server_name'] == null ? undefined : json['tls_server_name'],
        'uidStartNumber': json['uid_start_number'] == null ? undefined : json['uid_start_number'],
        'gidStartNumber': json['gid_start_number'] == null ? undefined : json['gid_start_number'],
        'searchMode': json['search_mode'] == null ? undefined : LDAPAPIAccessModeFromJSON(json['search_mode']),
        'bindMode': json['bind_mode'] == null ? undefined : LDAPAPIAccessModeFromJSON(json['bind_mode']),
        'mfaSupport': json['mfa_support'] == null ? undefined : json['mfa_support'],
    };
}

export function LDAPOutpostConfigToJSON(json: any): LDAPOutpostConfig {
    return LDAPOutpostConfigToJSONTyped(json, false);
}

export function LDAPOutpostConfigToJSONTyped(value?: Omit<LDAPOutpostConfig, 'pk'|'unbind_flow_slug'|'application_slug'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'base_dn': value['baseDn'],
        'bind_flow_slug': value['bindFlowSlug'],
        'certificate': value['certificate'],
        'tls_server_name': value['tlsServerName'],
        'uid_start_number': value['uidStartNumber'],
        'gid_start_number': value['gidStartNumber'],
        'search_mode': LDAPAPIAccessModeToJSON(value['searchMode']),
        'bind_mode': LDAPAPIAccessModeToJSON(value['bindMode']),
        'mfa_support': value['mfaSupport'],
    };
}

