/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.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 { PolicyEngineMode } from './PolicyEngineMode';
import {
    PolicyEngineModeFromJSON,
    PolicyEngineModeFromJSONTyped,
    PolicyEngineModeToJSON,
    PolicyEngineModeToJSONTyped,
} from './PolicyEngineMode';
import type { BindingTypeEnum } from './BindingTypeEnum';
import {
    BindingTypeEnumFromJSON,
    BindingTypeEnumFromJSONTyped,
    BindingTypeEnumToJSON,
    BindingTypeEnumToJSONTyped,
} from './BindingTypeEnum';
import type { DigestAlgorithmEnum } from './DigestAlgorithmEnum';
import {
    DigestAlgorithmEnumFromJSON,
    DigestAlgorithmEnumFromJSONTyped,
    DigestAlgorithmEnumToJSON,
    DigestAlgorithmEnumToJSONTyped,
} from './DigestAlgorithmEnum';
import type { UserMatchingModeEnum } from './UserMatchingModeEnum';
import {
    UserMatchingModeEnumFromJSON,
    UserMatchingModeEnumFromJSONTyped,
    UserMatchingModeEnumToJSON,
    UserMatchingModeEnumToJSONTyped,
} from './UserMatchingModeEnum';
import type { SignatureAlgorithmEnum } from './SignatureAlgorithmEnum';
import {
    SignatureAlgorithmEnumFromJSON,
    SignatureAlgorithmEnumFromJSONTyped,
    SignatureAlgorithmEnumToJSON,
    SignatureAlgorithmEnumToJSONTyped,
} from './SignatureAlgorithmEnum';
import type { SAMLNameIDPolicyEnum } from './SAMLNameIDPolicyEnum';
import {
    SAMLNameIDPolicyEnumFromJSON,
    SAMLNameIDPolicyEnumFromJSONTyped,
    SAMLNameIDPolicyEnumToJSON,
    SAMLNameIDPolicyEnumToJSONTyped,
} from './SAMLNameIDPolicyEnum';
import type { GroupMatchingModeEnum } from './GroupMatchingModeEnum';
import {
    GroupMatchingModeEnumFromJSON,
    GroupMatchingModeEnumFromJSONTyped,
    GroupMatchingModeEnumToJSON,
    GroupMatchingModeEnumToJSONTyped,
} from './GroupMatchingModeEnum';

/**
 * SAMLSource Serializer
 * @export
 * @interface SAMLSource
 */
export interface SAMLSource {
    /**
     * 
     * @type {string}
     * @memberof SAMLSource
     */
    readonly pk: string;
    /**
     * Source's display Name.
     * @type {string}
     * @memberof SAMLSource
     */
    name: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof SAMLSource
     */
    slug: string;
    /**
     * 
     * @type {boolean}
     * @memberof SAMLSource
     */
    enabled?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof SAMLSource
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof SAMLSource
     */
    enrollmentFlow?: string | null;
    /**
     * 
     * @type {Array<string>}
     * @memberof SAMLSource
     */
    userPropertyMappings?: Array<string>;
    /**
     * 
     * @type {Array<string>}
     * @memberof SAMLSource
     */
    groupPropertyMappings?: Array<string>;
    /**
     * Get object component so that we know how to edit the object
     * @type {string}
     * @memberof SAMLSource
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof SAMLSource
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof SAMLSource
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof SAMLSource
     */
    readonly metaModelName: string;
    /**
     * 
     * @type {PolicyEngineMode}
     * @memberof SAMLSource
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof SAMLSource
     */
    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 SAMLSource
     */
    readonly managed: string | null;
    /**
     * 
     * @type {string}
     * @memberof SAMLSource
     */
    userPathTemplate?: string;
    /**
     * 
     * @type {string}
     * @memberof SAMLSource
     */
    readonly icon: string;
    /**
     * How the source determines if an existing group should be used or a new group created.
     * @type {GroupMatchingModeEnum}
     * @memberof SAMLSource
     */
    groupMatchingMode?: GroupMatchingModeEnum;
    /**
     * Flow used before authentication.
     * @type {string}
     * @memberof SAMLSource
     */
    preAuthenticationFlow: string;
    /**
     * Also known as Entity ID. Defaults the Metadata URL.
     * @type {string}
     * @memberof SAMLSource
     */
    issuer?: string;
    /**
     * URL that the initial Login request is sent to.
     * @type {string}
     * @memberof SAMLSource
     */
    ssoUrl: string;
    /**
     * Optional URL if your IDP supports Single-Logout.
     * @type {string}
     * @memberof SAMLSource
     */
    sloUrl?: string | null;
    /**
     * Allows authentication flows initiated by the IdP. This can be a security risk, as no validation of the request ID is done.
     * @type {boolean}
     * @memberof SAMLSource
     */
    allowIdpInitiated?: boolean;
    /**
     * NameID Policy sent to the IdP. Can be unset, in which case no Policy is sent.
     * @type {SAMLNameIDPolicyEnum}
     * @memberof SAMLSource
     */
    nameIdPolicy?: SAMLNameIDPolicyEnum;
    /**
     * 
     * @type {BindingTypeEnum}
     * @memberof SAMLSource
     */
    bindingType?: BindingTypeEnum;
    /**
     * When selected, incoming assertion's Signatures will be validated against this certificate. To allow unsigned Requests, leave on default.
     * @type {string}
     * @memberof SAMLSource
     */
    verificationKp?: string | null;
    /**
     * Keypair used to sign outgoing Responses going to the Identity Provider.
     * @type {string}
     * @memberof SAMLSource
     */
    signingKp?: string | null;
    /**
     * 
     * @type {DigestAlgorithmEnum}
     * @memberof SAMLSource
     */
    digestAlgorithm?: DigestAlgorithmEnum;
    /**
     * 
     * @type {SignatureAlgorithmEnum}
     * @memberof SAMLSource
     */
    signatureAlgorithm?: SignatureAlgorithmEnum;
    /**
     * Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually. (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof SAMLSource
     */
    temporaryUserDeleteAfter?: string;
    /**
     * When selected, incoming assertions are encrypted by the IdP using the public key of the encryption keypair. The assertion is decrypted by the SP using the the private key.
     * @type {string}
     * @memberof SAMLSource
     */
    encryptionKp?: string | null;
}



/**
 * Check if a given object implements the SAMLSource interface.
 */
export function instanceOfSAMLSource(value: object): value is SAMLSource {
    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 (!('preAuthenticationFlow' in value) || value['preAuthenticationFlow'] === undefined) return false;
    if (!('ssoUrl' in value) || value['ssoUrl'] === undefined) return false;
    return true;
}

export function SAMLSourceFromJSON(json: any): SAMLSource {
    return SAMLSourceFromJSONTyped(json, false);
}

export function SAMLSourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): SAMLSource {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'name': json['name'],
        'slug': json['slug'],
        'enabled': json['enabled'] == null ? undefined : json['enabled'],
        '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']),
        'preAuthenticationFlow': json['pre_authentication_flow'],
        'issuer': json['issuer'] == null ? undefined : json['issuer'],
        'ssoUrl': json['sso_url'],
        'sloUrl': json['slo_url'] == null ? undefined : json['slo_url'],
        'allowIdpInitiated': json['allow_idp_initiated'] == null ? undefined : json['allow_idp_initiated'],
        'nameIdPolicy': json['name_id_policy'] == null ? undefined : SAMLNameIDPolicyEnumFromJSON(json['name_id_policy']),
        'bindingType': json['binding_type'] == null ? undefined : BindingTypeEnumFromJSON(json['binding_type']),
        'verificationKp': json['verification_kp'] == null ? undefined : json['verification_kp'],
        'signingKp': json['signing_kp'] == null ? undefined : json['signing_kp'],
        'digestAlgorithm': json['digest_algorithm'] == null ? undefined : DigestAlgorithmEnumFromJSON(json['digest_algorithm']),
        'signatureAlgorithm': json['signature_algorithm'] == null ? undefined : SignatureAlgorithmEnumFromJSON(json['signature_algorithm']),
        'temporaryUserDeleteAfter': json['temporary_user_delete_after'] == null ? undefined : json['temporary_user_delete_after'],
        'encryptionKp': json['encryption_kp'] == null ? undefined : json['encryption_kp'],
    };
}

export function SAMLSourceToJSON(json: any): SAMLSource {
    return SAMLSourceToJSONTyped(json, false);
}

export function SAMLSourceToJSONTyped(value?: Omit<SAMLSource, 'pk'|'component'|'verbose_name'|'verbose_name_plural'|'meta_model_name'|'managed'|'icon'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'slug': value['slug'],
        'enabled': value['enabled'],
        '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']),
        'pre_authentication_flow': value['preAuthenticationFlow'],
        'issuer': value['issuer'],
        'sso_url': value['ssoUrl'],
        'slo_url': value['sloUrl'],
        'allow_idp_initiated': value['allowIdpInitiated'],
        'name_id_policy': SAMLNameIDPolicyEnumToJSON(value['nameIdPolicy']),
        'binding_type': BindingTypeEnumToJSON(value['bindingType']),
        'verification_kp': value['verificationKp'],
        'signing_kp': value['signingKp'],
        'digest_algorithm': DigestAlgorithmEnumToJSON(value['digestAlgorithm']),
        'signature_algorithm': SignatureAlgorithmEnumToJSON(value['signatureAlgorithm']),
        'temporary_user_delete_after': value['temporaryUserDeleteAfter'],
        'encryption_kp': value['encryptionKp'],
    };
}

