/* 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 PatchedLDAPProviderRequest
 */
export interface PatchedLDAPProviderRequest {
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPProviderRequest
     */
    name?: string;
    /**
     * Flow used for authentication when the associated application is accessed by an un-authenticated user.
     * @type {string}
     * @memberof PatchedLDAPProviderRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow used when authorizing this provider.
     * @type {string}
     * @memberof PatchedLDAPProviderRequest
     */
    authorizationFlow?: string;
    /**
     * Flow used ending the session from a provider.
     * @type {string}
     * @memberof PatchedLDAPProviderRequest
     */
    invalidationFlow?: string;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedLDAPProviderRequest
     */
    propertyMappings?: Array<string>;
    /**
     * DN under which objects are accessible.
     * @type {string}
     * @memberof PatchedLDAPProviderRequest
     */
    baseDn?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPProviderRequest
     */
    certificate?: string | null;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPProviderRequest
     */
    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 PatchedLDAPProviderRequest
     */
    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 PatchedLDAPProviderRequest
     */
    gidStartNumber?: number;
    /**
     *
     * @type {LDAPAPIAccessMode}
     * @memberof PatchedLDAPProviderRequest
     */
    searchMode?: LDAPAPIAccessMode;
    /**
     *
     * @type {LDAPAPIAccessMode}
     * @memberof PatchedLDAPProviderRequest
     */
    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 PatchedLDAPProviderRequest
     */
    mfaSupport?: boolean;
}

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

export function PatchedLDAPProviderRequestFromJSON(json: any): PatchedLDAPProviderRequest {
    return PatchedLDAPProviderRequestFromJSONTyped(json, false);
}

export function PatchedLDAPProviderRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedLDAPProviderRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : json["name"],
        authenticationFlow:
            json["authentication_flow"] == null ? undefined : json["authentication_flow"],
        authorizationFlow:
            json["authorization_flow"] == null ? undefined : json["authorization_flow"],
        invalidationFlow: json["invalidation_flow"] == null ? undefined : json["invalidation_flow"],
        propertyMappings: json["property_mappings"] == null ? undefined : json["property_mappings"],
        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"],
        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 PatchedLDAPProviderRequestToJSON(json: any): PatchedLDAPProviderRequest {
    return PatchedLDAPProviderRequestToJSONTyped(json, false);
}

export function PatchedLDAPProviderRequestToJSONTyped(
    value?: PatchedLDAPProviderRequest | 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"],
    };
}
