/* 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 { GroupMatchingModeEnum } from "./GroupMatchingModeEnum";
import {
    GroupMatchingModeEnumFromJSON,
    GroupMatchingModeEnumToJSON,
} from "./GroupMatchingModeEnum";
import type { KadminTypeEnum } from "./KadminTypeEnum";
import { KadminTypeEnumFromJSON, KadminTypeEnumToJSON } from "./KadminTypeEnum";
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";

/**
 * Kerberos Source Serializer
 * @export
 * @interface KerberosSourceRequest
 */
export interface KerberosSourceRequest {
    /**
     * Source's display Name.
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    name: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    slug: string;
    /**
     *
     * @type {boolean}
     * @memberof KerberosSourceRequest
     */
    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 KerberosSourceRequest
     */
    promoted?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    enrollmentFlow?: string | null;
    /**
     *
     * @type {Array<string>}
     * @memberof KerberosSourceRequest
     */
    userPropertyMappings?: Array<string>;
    /**
     *
     * @type {Array<string>}
     * @memberof KerberosSourceRequest
     */
    groupPropertyMappings?: Array<string>;
    /**
     *
     * @type {PolicyEngineMode}
     * @memberof KerberosSourceRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof KerberosSourceRequest
     */
    userMatchingMode?: UserMatchingModeEnum;
    /**
     *
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    userPathTemplate?: string;
    /**
     *
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    icon?: string;
    /**
     * How the source determines if an existing group should be used or a new group created.
     * @type {GroupMatchingModeEnum}
     * @memberof KerberosSourceRequest
     */
    groupMatchingMode?: GroupMatchingModeEnum;
    /**
     * Kerberos realm
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    realm: string;
    /**
     * Custom krb5.conf to use. Uses the system one by default
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    krb5Conf?: string;
    /**
     * KAdmin server type
     * @type {KadminTypeEnum}
     * @memberof KerberosSourceRequest
     */
    kadminType?: KadminTypeEnum;
    /**
     * Sync users from Kerberos into authentik
     * @type {boolean}
     * @memberof KerberosSourceRequest
     */
    syncUsers?: boolean;
    /**
     * When a user changes their password, sync it back to Kerberos
     * @type {boolean}
     * @memberof KerberosSourceRequest
     */
    syncUsersPassword?: boolean;
    /**
     * Principal to authenticate to kadmin for sync.
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    syncPrincipal?: string;
    /**
     * Password to authenticate to kadmin for sync
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    syncPassword?: string;
    /**
     * Keytab to authenticate to kadmin for sync. Must be base64-encoded or in the form TYPE:residual
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    syncKeytab?: string;
    /**
     * Credentials cache to authenticate to kadmin for sync. Must be in the form TYPE:residual
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    syncCcache?: string;
    /**
     * Force the use of a specific server name for SPNEGO. Must be in the form HTTP@hostname
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    spnegoServerName?: string;
    /**
     * SPNEGO keytab base64-encoded or path to keytab in the form FILE:path
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    spnegoKeytab?: string;
    /**
     * Credential cache to use for SPNEGO in form type:residual
     * @type {string}
     * @memberof KerberosSourceRequest
     */
    spnegoCcache?: string;
    /**
     * If enabled, the authentik-stored password will be updated upon login with the Kerberos password backend
     * @type {boolean}
     * @memberof KerberosSourceRequest
     */
    passwordLoginUpdateInternalPassword?: boolean;
    /**
     * When to trigger sync for outgoing providers
     * @type {SyncOutgoingTriggerModeEnum}
     * @memberof KerberosSourceRequest
     */
    syncOutgoingTriggerMode?: SyncOutgoingTriggerModeEnum;
}

/**
 * Check if a given object implements the KerberosSourceRequest interface.
 */
export function instanceOfKerberosSourceRequest(value: object): value is KerberosSourceRequest {
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("slug" in value) || value["slug"] === undefined) return false;
    if (!("realm" in value) || value["realm"] === undefined) return false;
    return true;
}

export function KerberosSourceRequestFromJSON(json: any): KerberosSourceRequest {
    return KerberosSourceRequestFromJSONTyped(json, false);
}

export function KerberosSourceRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): KerberosSourceRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        slug: 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"],
        groupMatchingMode:
            json["group_matching_mode"] == null
                ? undefined
                : GroupMatchingModeEnumFromJSON(json["group_matching_mode"]),
        realm: json["realm"],
        krb5Conf: json["krb5_conf"] == null ? undefined : json["krb5_conf"],
        kadminType:
            json["kadmin_type"] == null ? undefined : KadminTypeEnumFromJSON(json["kadmin_type"]),
        syncUsers: json["sync_users"] == null ? undefined : json["sync_users"],
        syncUsersPassword:
            json["sync_users_password"] == null ? undefined : json["sync_users_password"],
        syncPrincipal: json["sync_principal"] == null ? undefined : json["sync_principal"],
        syncPassword: json["sync_password"] == null ? undefined : json["sync_password"],
        syncKeytab: json["sync_keytab"] == null ? undefined : json["sync_keytab"],
        syncCcache: json["sync_ccache"] == null ? undefined : json["sync_ccache"],
        spnegoServerName:
            json["spnego_server_name"] == null ? undefined : json["spnego_server_name"],
        spnegoKeytab: json["spnego_keytab"] == null ? undefined : json["spnego_keytab"],
        spnegoCcache: json["spnego_ccache"] == null ? undefined : json["spnego_ccache"],
        passwordLoginUpdateInternalPassword:
            json["password_login_update_internal_password"] == null
                ? undefined
                : json["password_login_update_internal_password"],
        syncOutgoingTriggerMode:
            json["sync_outgoing_trigger_mode"] == null
                ? undefined
                : SyncOutgoingTriggerModeEnumFromJSON(json["sync_outgoing_trigger_mode"]),
    };
}

export function KerberosSourceRequestToJSON(json: any): KerberosSourceRequest {
    return KerberosSourceRequestToJSONTyped(json, false);
}

export function KerberosSourceRequestToJSONTyped(
    value?: KerberosSourceRequest | 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"],
        group_matching_mode: GroupMatchingModeEnumToJSON(value["groupMatchingMode"]),
        realm: value["realm"],
        krb5_conf: value["krb5Conf"],
        kadmin_type: KadminTypeEnumToJSON(value["kadminType"]),
        sync_users: value["syncUsers"],
        sync_users_password: value["syncUsersPassword"],
        sync_principal: value["syncPrincipal"],
        sync_password: value["syncPassword"],
        sync_keytab: value["syncKeytab"],
        sync_ccache: value["syncCcache"],
        spnego_server_name: value["spnegoServerName"],
        spnego_keytab: value["spnegoKeytab"],
        spnego_ccache: value["spnegoCcache"],
        password_login_update_internal_password: value["passwordLoginUpdateInternalPassword"],
        sync_outgoing_trigger_mode: SyncOutgoingTriggerModeEnumToJSON(
            value["syncOutgoingTriggerMode"],
        ),
    };
}
