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

/**
 * LDAPProvider Serializer
 * @export
 * @interface LDAPProvider
 */
export interface LDAPProvider {
    /**
     *
     * @type {number}
     * @memberof LDAPProvider
     */
    readonly pk: number;
    /**
     *
     * @type {string}
     * @memberof LDAPProvider
     */
    name: string;
    /**
     * Flow used for authentication when the associated application is accessed by an un-authenticated user.
     * @type {string}
     * @memberof LDAPProvider
     */
    authenticationFlow?: string | null;
    /**
     * Flow used when authorizing this provider.
     * @type {string}
     * @memberof LDAPProvider
     */
    authorizationFlow: string;
    /**
     * Flow used ending the session from a provider.
     * @type {string}
     * @memberof LDAPProvider
     */
    invalidationFlow: string;
    /**
     *
     * @type {Array<string>}
     * @memberof LDAPProvider
     */
    propertyMappings?: Array<string>;
    /**
     * Get object component so that we know how to edit the object
     * @type {string}
     * @memberof LDAPProvider
     */
    readonly component: string;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof LDAPProvider
     */
    readonly assignedApplicationSlug: string | null;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof LDAPProvider
     */
    readonly assignedApplicationName: string | null;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof LDAPProvider
     */
    readonly assignedBackchannelApplicationSlug: string | null;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof LDAPProvider
     */
    readonly assignedBackchannelApplicationName: string | null;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof LDAPProvider
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof LDAPProvider
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof LDAPProvider
     */
    readonly metaModelName: string;
    /**
     * DN under which objects are accessible.
     * @type {string}
     * @memberof LDAPProvider
     */
    baseDn?: string;
    /**
     *
     * @type {string}
     * @memberof LDAPProvider
     */
    certificate?: string | null;
    /**
     *
     * @type {string}
     * @memberof LDAPProvider
     */
    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 LDAPProvider
     */
    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 LDAPProvider
     */
    gidStartNumber?: number;
    /**
     *
     * @type {Array<string>}
     * @memberof LDAPProvider
     */
    readonly outpostSet: Array<string>;
    /**
     *
     * @type {LDAPAPIAccessMode}
     * @memberof LDAPProvider
     */
    searchMode?: LDAPAPIAccessMode;
    /**
     *
     * @type {LDAPAPIAccessMode}
     * @memberof LDAPProvider
     */
    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 LDAPProvider
     */
    mfaSupport?: boolean;
}

/**
 * Check if a given object implements the LDAPProvider interface.
 */
export function instanceOfLDAPProvider(value: object): value is LDAPProvider {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("authorizationFlow" in value) || value["authorizationFlow"] === undefined) return false;
    if (!("invalidationFlow" in value) || value["invalidationFlow"] === undefined) return false;
    if (!("component" in value) || value["component"] === undefined) return false;
    if (!("assignedApplicationSlug" in value) || value["assignedApplicationSlug"] === undefined)
        return false;
    if (!("assignedApplicationName" in value) || value["assignedApplicationName"] === undefined)
        return false;
    if (
        !("assignedBackchannelApplicationSlug" in value) ||
        value["assignedBackchannelApplicationSlug"] === undefined
    )
        return false;
    if (
        !("assignedBackchannelApplicationName" in value) ||
        value["assignedBackchannelApplicationName"] === undefined
    )
        return false;
    if (!("verboseName" in value) || value["verboseName"] === undefined) return false;
    if (!("verboseNamePlural" in value) || value["verboseNamePlural"] === undefined) return false;
    if (!("metaModelName" in value) || value["metaModelName"] === undefined) return false;
    if (!("outpostSet" in value) || value["outpostSet"] === undefined) return false;
    return true;
}

export function LDAPProviderFromJSON(json: any): LDAPProvider {
    return LDAPProviderFromJSONTyped(json, false);
}

export function LDAPProviderFromJSONTyped(json: any, ignoreDiscriminator: boolean): LDAPProvider {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        authenticationFlow:
            json["authentication_flow"] == null ? undefined : json["authentication_flow"],
        authorizationFlow: json["authorization_flow"],
        invalidationFlow: json["invalidation_flow"],
        propertyMappings: json["property_mappings"] == null ? undefined : json["property_mappings"],
        component: json["component"],
        assignedApplicationSlug: json["assigned_application_slug"],
        assignedApplicationName: json["assigned_application_name"],
        assignedBackchannelApplicationSlug: json["assigned_backchannel_application_slug"],
        assignedBackchannelApplicationName: json["assigned_backchannel_application_name"],
        verboseName: json["verbose_name"],
        verboseNamePlural: json["verbose_name_plural"],
        metaModelName: json["meta_model_name"],
        baseDn: json["base_dn"] == null ? undefined : json["base_dn"],
        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"],
        outpostSet: json["outpost_set"],
        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 LDAPProviderToJSON(json: any): LDAPProvider {
    return LDAPProviderToJSONTyped(json, false);
}

export function LDAPProviderToJSONTyped(
    value?: Omit<
        LDAPProvider,
        | "pk"
        | "component"
        | "assigned_application_slug"
        | "assigned_application_name"
        | "assigned_backchannel_application_slug"
        | "assigned_backchannel_application_name"
        | "verbose_name"
        | "verbose_name_plural"
        | "meta_model_name"
        | "outpost_set"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        authentication_flow: value["authenticationFlow"],
        authorization_flow: value["authorizationFlow"],
        invalidation_flow: value["invalidationFlow"],
        property_mappings: value["propertyMappings"],
        base_dn: value["baseDn"],
        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"],
    };
}
