/* 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 { PolicyEngineMode } from "./PolicyEngineMode";
import { PolicyEngineModeFromJSON, PolicyEngineModeToJSON } from "./PolicyEngineMode";
import type { SyncOutgoingTriggerModeEnum } from "./SyncOutgoingTriggerModeEnum";
import {
    SyncOutgoingTriggerModeEnumFromJSON,
    SyncOutgoingTriggerModeEnumToJSON,
} from "./SyncOutgoingTriggerModeEnum";
import type { UserMatchingModeEnum } from "./UserMatchingModeEnum";
import { UserMatchingModeEnumFromJSON, UserMatchingModeEnumToJSON } from "./UserMatchingModeEnum";

/**
 * LDAP Source Serializer
 * @export
 * @interface PatchedLDAPSourceRequest
 */
export interface PatchedLDAPSourceRequest {
    /**
     * Source's display Name.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    name?: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    slug?: string;
    /**
     *
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    enabled?: boolean;
    /**
     * When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon.
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    promoted?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    enrollmentFlow?: string | null;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedLDAPSourceRequest
     */
    userPropertyMappings?: Array<string>;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedLDAPSourceRequest
     */
    groupPropertyMappings?: Array<string>;
    /**
     *
     * @type {PolicyEngineMode}
     * @memberof PatchedLDAPSourceRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof PatchedLDAPSourceRequest
     */
    userMatchingMode?: UserMatchingModeEnum;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    userPathTemplate?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    icon?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    serverUri?: string;
    /**
     * Optionally verify the LDAP Server's Certificate against the CA Chain in this keypair.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    peerCertificate?: string | null;
    /**
     * Client certificate to authenticate against the LDAP Server's Certificate.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    clientCertificate?: string | null;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    bindCn?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    bindPassword?: string;
    /**
     *
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    startTls?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    sni?: boolean;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    baseDn?: string;
    /**
     * Prepended to Base DN for User-queries.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    additionalUserDn?: string;
    /**
     * Prepended to Base DN for Group-queries.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    additionalGroupDn?: string;
    /**
     * Consider Objects matching this filter to be Users.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    userObjectFilter?: string;
    /**
     * Consider Objects matching this filter to be Groups.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    groupObjectFilter?: string;
    /**
     * Field which contains members of a group.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    groupMembershipField?: string;
    /**
     * Attribute which matches the value of `group_membership_field`.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    userMembershipAttribute?: string;
    /**
     * Field which contains a unique Identifier.
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    objectUniquenessField?: string;
    /**
     * Update internal authentik password when login succeeds with LDAP
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    passwordLoginUpdateInternalPassword?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    syncUsers?: boolean;
    /**
     * When a user changes their password, sync it back to LDAP. This can only be enabled on a single LDAP source.
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    syncUsersPassword?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    syncGroups?: boolean;
    /**
     *
     * @type {string}
     * @memberof PatchedLDAPSourceRequest
     */
    syncParentGroup?: string | null;
    /**
     * Lookup group membership based on a user attribute instead of a group attribute. This allows nested group resolution on systems like FreeIPA and Active Directory
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    lookupGroupsFromUser?: boolean;
    /**
     * Delete authentik users and groups which were previously supplied by this source, but are now missing from it.
     * @type {boolean}
     * @memberof PatchedLDAPSourceRequest
     */
    deleteNotFoundObjects?: boolean;
    /**
     * When to trigger sync for outgoing providers
     * @type {SyncOutgoingTriggerModeEnum}
     * @memberof PatchedLDAPSourceRequest
     */
    syncOutgoingTriggerMode?: SyncOutgoingTriggerModeEnum;
}

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

export function PatchedLDAPSourceRequestFromJSON(json: any): PatchedLDAPSourceRequest {
    return PatchedLDAPSourceRequestFromJSONTyped(json, false);
}

export function PatchedLDAPSourceRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedLDAPSourceRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : json["name"],
        slug: json["slug"] == null ? undefined : json["slug"],
        enabled: json["enabled"] == null ? undefined : json["enabled"],
        promoted: json["promoted"] == null ? undefined : json["promoted"],
        authenticationFlow:
            json["authentication_flow"] == null ? undefined : json["authentication_flow"],
        enrollmentFlow: json["enrollment_flow"] == null ? undefined : json["enrollment_flow"],
        userPropertyMappings:
            json["user_property_mappings"] == null ? undefined : json["user_property_mappings"],
        groupPropertyMappings:
            json["group_property_mappings"] == null ? undefined : json["group_property_mappings"],
        policyEngineMode:
            json["policy_engine_mode"] == null
                ? undefined
                : PolicyEngineModeFromJSON(json["policy_engine_mode"]),
        userMatchingMode:
            json["user_matching_mode"] == null
                ? undefined
                : UserMatchingModeEnumFromJSON(json["user_matching_mode"]),
        userPathTemplate:
            json["user_path_template"] == null ? undefined : json["user_path_template"],
        icon: json["icon"] == null ? undefined : json["icon"],
        serverUri: json["server_uri"] == null ? undefined : json["server_uri"],
        peerCertificate: json["peer_certificate"] == null ? undefined : json["peer_certificate"],
        clientCertificate:
            json["client_certificate"] == null ? undefined : json["client_certificate"],
        bindCn: json["bind_cn"] == null ? undefined : json["bind_cn"],
        bindPassword: json["bind_password"] == null ? undefined : json["bind_password"],
        startTls: json["start_tls"] == null ? undefined : json["start_tls"],
        sni: json["sni"] == null ? undefined : json["sni"],
        baseDn: json["base_dn"] == null ? undefined : json["base_dn"],
        additionalUserDn:
            json["additional_user_dn"] == null ? undefined : json["additional_user_dn"],
        additionalGroupDn:
            json["additional_group_dn"] == null ? undefined : json["additional_group_dn"],
        userObjectFilter:
            json["user_object_filter"] == null ? undefined : json["user_object_filter"],
        groupObjectFilter:
            json["group_object_filter"] == null ? undefined : json["group_object_filter"],
        groupMembershipField:
            json["group_membership_field"] == null ? undefined : json["group_membership_field"],
        userMembershipAttribute:
            json["user_membership_attribute"] == null
                ? undefined
                : json["user_membership_attribute"],
        objectUniquenessField:
            json["object_uniqueness_field"] == null ? undefined : json["object_uniqueness_field"],
        passwordLoginUpdateInternalPassword:
            json["password_login_update_internal_password"] == null
                ? undefined
                : json["password_login_update_internal_password"],
        syncUsers: json["sync_users"] == null ? undefined : json["sync_users"],
        syncUsersPassword:
            json["sync_users_password"] == null ? undefined : json["sync_users_password"],
        syncGroups: json["sync_groups"] == null ? undefined : json["sync_groups"],
        syncParentGroup: json["sync_parent_group"] == null ? undefined : json["sync_parent_group"],
        lookupGroupsFromUser:
            json["lookup_groups_from_user"] == null ? undefined : json["lookup_groups_from_user"],
        deleteNotFoundObjects:
            json["delete_not_found_objects"] == null ? undefined : json["delete_not_found_objects"],
        syncOutgoingTriggerMode:
            json["sync_outgoing_trigger_mode"] == null
                ? undefined
                : SyncOutgoingTriggerModeEnumFromJSON(json["sync_outgoing_trigger_mode"]),
    };
}

export function PatchedLDAPSourceRequestToJSON(json: any): PatchedLDAPSourceRequest {
    return PatchedLDAPSourceRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        slug: value["slug"],
        enabled: value["enabled"],
        promoted: value["promoted"],
        authentication_flow: value["authenticationFlow"],
        enrollment_flow: value["enrollmentFlow"],
        user_property_mappings: value["userPropertyMappings"],
        group_property_mappings: value["groupPropertyMappings"],
        policy_engine_mode: PolicyEngineModeToJSON(value["policyEngineMode"]),
        user_matching_mode: UserMatchingModeEnumToJSON(value["userMatchingMode"]),
        user_path_template: value["userPathTemplate"],
        icon: value["icon"],
        server_uri: value["serverUri"],
        peer_certificate: value["peerCertificate"],
        client_certificate: value["clientCertificate"],
        bind_cn: value["bindCn"],
        bind_password: value["bindPassword"],
        start_tls: value["startTls"],
        sni: value["sni"],
        base_dn: value["baseDn"],
        additional_user_dn: value["additionalUserDn"],
        additional_group_dn: value["additionalGroupDn"],
        user_object_filter: value["userObjectFilter"],
        group_object_filter: value["groupObjectFilter"],
        group_membership_field: value["groupMembershipField"],
        user_membership_attribute: value["userMembershipAttribute"],
        object_uniqueness_field: value["objectUniquenessField"],
        password_login_update_internal_password: value["passwordLoginUpdateInternalPassword"],
        sync_users: value["syncUsers"],
        sync_users_password: value["syncUsersPassword"],
        sync_groups: value["syncGroups"],
        sync_parent_group: value["syncParentGroup"],
        lookup_groups_from_user: value["lookupGroupsFromUser"],
        delete_not_found_objects: value["deleteNotFoundObjects"],
        sync_outgoing_trigger_mode: SyncOutgoingTriggerModeEnumToJSON(
            value["syncOutgoingTriggerMode"],
        ),
    };
}
