/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.12.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 { KadminTypeEnum } from './KadminTypeEnum';
import {
    KadminTypeEnumFromJSON,
    KadminTypeEnumFromJSONTyped,
    KadminTypeEnumToJSON,
    KadminTypeEnumToJSONTyped,
} from './KadminTypeEnum';
import type { PolicyEngineMode } from './PolicyEngineMode';
import {
    PolicyEngineModeFromJSON,
    PolicyEngineModeFromJSONTyped,
    PolicyEngineModeToJSON,
    PolicyEngineModeToJSONTyped,
} from './PolicyEngineMode';
import type { UserMatchingModeEnum } from './UserMatchingModeEnum';
import {
    UserMatchingModeEnumFromJSON,
    UserMatchingModeEnumFromJSONTyped,
    UserMatchingModeEnumToJSON,
    UserMatchingModeEnumToJSONTyped,
} from './UserMatchingModeEnum';
import type { GroupMatchingModeEnum } from './GroupMatchingModeEnum';
import {
    GroupMatchingModeEnumFromJSON,
    GroupMatchingModeEnumFromJSONTyped,
    GroupMatchingModeEnumToJSON,
    GroupMatchingModeEnumToJSONTyped,
} from './GroupMatchingModeEnum';

/**
 * Kerberos Source Serializer
 * @export
 * @interface KerberosSource
 */
export interface KerberosSource {
    /**
     * 
     * @type {string}
     * @memberof KerberosSource
     */
    readonly pk: string;
    /**
     * Source's display Name.
     * @type {string}
     * @memberof KerberosSource
     */
    name: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof KerberosSource
     */
    slug: string;
    /**
     * 
     * @type {boolean}
     * @memberof KerberosSource
     */
    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 KerberosSource
     */
    promoted?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof KerberosSource
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof KerberosSource
     */
    enrollmentFlow?: string | null;
    /**
     * 
     * @type {Array<string>}
     * @memberof KerberosSource
     */
    userPropertyMappings?: Array<string>;
    /**
     * 
     * @type {Array<string>}
     * @memberof KerberosSource
     */
    groupPropertyMappings?: Array<string>;
    /**
     * Get object component so that we know how to edit the object
     * @type {string}
     * @memberof KerberosSource
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof KerberosSource
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof KerberosSource
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof KerberosSource
     */
    readonly metaModelName: string;
    /**
     * 
     * @type {PolicyEngineMode}
     * @memberof KerberosSource
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof KerberosSource
     */
    userMatchingMode?: UserMatchingModeEnum;
    /**
     * Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.
     * @type {string}
     * @memberof KerberosSource
     */
    readonly managed: string | null;
    /**
     * 
     * @type {string}
     * @memberof KerberosSource
     */
    userPathTemplate?: string;
    /**
     * 
     * @type {string}
     * @memberof KerberosSource
     */
    readonly icon: string;
    /**
     * How the source determines if an existing group should be used or a new group created.
     * @type {GroupMatchingModeEnum}
     * @memberof KerberosSource
     */
    groupMatchingMode?: GroupMatchingModeEnum;
    /**
     * Kerberos realm
     * @type {string}
     * @memberof KerberosSource
     */
    realm: string;
    /**
     * Custom krb5.conf to use. Uses the system one by default
     * @type {string}
     * @memberof KerberosSource
     */
    krb5Conf?: string;
    /**
     * KAdmin server type
     * @type {KadminTypeEnum}
     * @memberof KerberosSource
     */
    kadminType?: KadminTypeEnum;
    /**
     * Sync users from Kerberos into authentik
     * @type {boolean}
     * @memberof KerberosSource
     */
    syncUsers?: boolean;
    /**
     * When a user changes their password, sync it back to Kerberos
     * @type {boolean}
     * @memberof KerberosSource
     */
    syncUsersPassword?: boolean;
    /**
     * Principal to authenticate to kadmin for sync.
     * @type {string}
     * @memberof KerberosSource
     */
    syncPrincipal?: string;
    /**
     * Credentials cache to authenticate to kadmin for sync. Must be in the form TYPE:residual
     * @type {string}
     * @memberof KerberosSource
     */
    syncCcache?: string;
    /**
     * Get cached source connectivity
     * @type {{ [key: string]: string; }}
     * @memberof KerberosSource
     */
    readonly connectivity: { [key: string]: string; } | null;
    /**
     * Force the use of a specific server name for SPNEGO. Must be in the form HTTP@hostname
     * @type {string}
     * @memberof KerberosSource
     */
    spnegoServerName?: string;
    /**
     * Credential cache to use for SPNEGO in form type:residual
     * @type {string}
     * @memberof KerberosSource
     */
    spnegoCcache?: string;
    /**
     * If enabled, the authentik-stored password will be updated upon login with the Kerberos password backend
     * @type {boolean}
     * @memberof KerberosSource
     */
    passwordLoginUpdateInternalPassword?: boolean;
}



/**
 * Check if a given object implements the KerberosSource interface.
 */
export function instanceOfKerberosSource(value: object): value is KerberosSource {
    if (!('pk' in value) || value['pk'] === undefined) return false;
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('slug' in value) || value['slug'] === undefined) return false;
    if (!('component' in value) || value['component'] === 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 (!('managed' in value) || value['managed'] === undefined) return false;
    if (!('icon' in value) || value['icon'] === undefined) return false;
    if (!('realm' in value) || value['realm'] === undefined) return false;
    if (!('connectivity' in value) || value['connectivity'] === undefined) return false;
    return true;
}

export function KerberosSourceFromJSON(json: any): KerberosSource {
    return KerberosSourceFromJSONTyped(json, false);
}

export function KerberosSourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): KerberosSource {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        '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'],
        'component': json['component'],
        'verboseName': json['verbose_name'],
        'verboseNamePlural': json['verbose_name_plural'],
        'metaModelName': json['meta_model_name'],
        'policyEngineMode': json['policy_engine_mode'] == null ? undefined : PolicyEngineModeFromJSON(json['policy_engine_mode']),
        'userMatchingMode': json['user_matching_mode'] == null ? undefined : UserMatchingModeEnumFromJSON(json['user_matching_mode']),
        'managed': json['managed'],
        'userPathTemplate': json['user_path_template'] == null ? undefined : json['user_path_template'],
        'icon': 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'],
        'syncCcache': json['sync_ccache'] == null ? undefined : json['sync_ccache'],
        'connectivity': json['connectivity'],
        'spnegoServerName': json['spnego_server_name'] == null ? undefined : json['spnego_server_name'],
        'spnegoCcache': json['spnego_ccache'] == null ? undefined : json['spnego_ccache'],
        'passwordLoginUpdateInternalPassword': json['password_login_update_internal_password'] == null ? undefined : json['password_login_update_internal_password'],
    };
}

export function KerberosSourceToJSON(json: any): KerberosSource {
    return KerberosSourceToJSONTyped(json, false);
}

export function KerberosSourceToJSONTyped(value?: Omit<KerberosSource, 'pk'|'component'|'verbose_name'|'verbose_name_plural'|'meta_model_name'|'managed'|'icon'|'connectivity'> | 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'],
        '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_ccache': value['syncCcache'],
        'spnego_server_name': value['spnegoServerName'],
        'spnego_ccache': value['spnegoCcache'],
        'password_login_update_internal_password': value['passwordLoginUpdateInternalPassword'],
    };
}

