/* 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 { 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 PatchedSAMLSourceRequest
 */
export interface PatchedSAMLSourceRequest {
    /**
     * Source's display Name.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    name?: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    slug?: string;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedSAMLSourceRequest
     */
    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 PatchedSAMLSourceRequest
     */
    promoted?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    enrollmentFlow?: string | null;
    /**
     * 
     * @type {Array<string>}
     * @memberof PatchedSAMLSourceRequest
     */
    userPropertyMappings?: Array<string>;
    /**
     * 
     * @type {Array<string>}
     * @memberof PatchedSAMLSourceRequest
     */
    groupPropertyMappings?: Array<string>;
    /**
     * 
     * @type {PolicyEngineMode}
     * @memberof PatchedSAMLSourceRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof PatchedSAMLSourceRequest
     */
    userMatchingMode?: UserMatchingModeEnum;
    /**
     * 
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    userPathTemplate?: string;
    /**
     * How the source determines if an existing group should be used or a new group created.
     * @type {GroupMatchingModeEnum}
     * @memberof PatchedSAMLSourceRequest
     */
    groupMatchingMode?: GroupMatchingModeEnum;
    /**
     * Flow used before authentication.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    preAuthenticationFlow?: string;
    /**
     * Also known as Entity ID. Defaults the Metadata URL.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    issuer?: string;
    /**
     * URL that the initial Login request is sent to.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    ssoUrl?: string;
    /**
     * Optional URL if your IDP supports Single-Logout.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    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 PatchedSAMLSourceRequest
     */
    allowIdpInitiated?: boolean;
    /**
     * NameID Policy sent to the IdP. Can be unset, in which case no Policy is sent.
     * @type {SAMLNameIDPolicyEnum}
     * @memberof PatchedSAMLSourceRequest
     */
    nameIdPolicy?: SAMLNameIDPolicyEnum;
    /**
     * 
     * @type {BindingTypeEnum}
     * @memberof PatchedSAMLSourceRequest
     */
    bindingType?: BindingTypeEnum;
    /**
     * When selected, incoming assertion's Signatures will be validated against this certificate. To allow unsigned Requests, leave on default.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    verificationKp?: string | null;
    /**
     * Keypair used to sign outgoing Responses going to the Identity Provider.
     * @type {string}
     * @memberof PatchedSAMLSourceRequest
     */
    signingKp?: string | null;
    /**
     * 
     * @type {DigestAlgorithmEnum}
     * @memberof PatchedSAMLSourceRequest
     */
    digestAlgorithm?: DigestAlgorithmEnum;
    /**
     * 
     * @type {SignatureAlgorithmEnum}
     * @memberof PatchedSAMLSourceRequest
     */
    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 PatchedSAMLSourceRequest
     */
    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 PatchedSAMLSourceRequest
     */
    encryptionKp?: string | null;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedSAMLSourceRequest
     */
    signedAssertion?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedSAMLSourceRequest
     */
    signedResponse?: boolean;
}



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

export function PatchedSAMLSourceRequestFromJSON(json: any): PatchedSAMLSourceRequest {
    return PatchedSAMLSourceRequestFromJSONTyped(json, false);
}

export function PatchedSAMLSourceRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedSAMLSourceRequest {
    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'],
        'groupMatchingMode': json['group_matching_mode'] == null ? undefined : GroupMatchingModeEnumFromJSON(json['group_matching_mode']),
        'preAuthenticationFlow': json['pre_authentication_flow'] == null ? undefined : json['pre_authentication_flow'],
        'issuer': json['issuer'] == null ? undefined : json['issuer'],
        'ssoUrl': json['sso_url'] == null ? undefined : 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'],
        'signedAssertion': json['signed_assertion'] == null ? undefined : json['signed_assertion'],
        'signedResponse': json['signed_response'] == null ? undefined : json['signed_response'],
    };
}

export function PatchedSAMLSourceRequestToJSON(json: any): PatchedSAMLSourceRequest {
    return PatchedSAMLSourceRequestToJSONTyped(json, false);
}

export function PatchedSAMLSourceRequestToJSONTyped(value?: PatchedSAMLSourceRequest | 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']),
        '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'],
        'signed_assertion': value['signedAssertion'],
        'signed_response': value['signedResponse'],
    };
}

