/* 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 { DigestAlgorithmEnum } from './DigestAlgorithmEnum';
import {
    DigestAlgorithmEnumFromJSON,
    DigestAlgorithmEnumFromJSONTyped,
    DigestAlgorithmEnumToJSON,
    DigestAlgorithmEnumToJSONTyped,
} from './DigestAlgorithmEnum';
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 { SpBindingEnum } from './SpBindingEnum';
import {
    SpBindingEnumFromJSON,
    SpBindingEnumFromJSONTyped,
    SpBindingEnumToJSON,
    SpBindingEnumToJSONTyped,
} from './SpBindingEnum';

/**
 * SAMLProvider Serializer
 * @export
 * @interface SAMLProvider
 */
export interface SAMLProvider {
    /**
     * 
     * @type {number}
     * @memberof SAMLProvider
     */
    readonly pk: number;
    /**
     * 
     * @type {string}
     * @memberof SAMLProvider
     */
    name: string;
    /**
     * Flow used for authentication when the associated application is accessed by an un-authenticated user.
     * @type {string}
     * @memberof SAMLProvider
     */
    authenticationFlow?: string | null;
    /**
     * Flow used when authorizing this provider.
     * @type {string}
     * @memberof SAMLProvider
     */
    authorizationFlow: string;
    /**
     * Flow used ending the session from a provider.
     * @type {string}
     * @memberof SAMLProvider
     */
    invalidationFlow: string;
    /**
     * 
     * @type {Array<string>}
     * @memberof SAMLProvider
     */
    propertyMappings?: Array<string>;
    /**
     * Get object component so that we know how to edit the object
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly component: string;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly assignedApplicationSlug: string;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly assignedApplicationName: string;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly assignedBackchannelApplicationSlug: string;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly assignedBackchannelApplicationName: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly metaModelName: string;
    /**
     * 
     * @type {string}
     * @memberof SAMLProvider
     */
    acsUrl: string;
    /**
     * Value of the audience restriction field of the assertion. When left empty, no audience restriction will be added.
     * @type {string}
     * @memberof SAMLProvider
     */
    audience?: string;
    /**
     * Also known as EntityID
     * @type {string}
     * @memberof SAMLProvider
     */
    issuer?: string;
    /**
     * Assertion valid not before current time + this value (Format: hours=-1;minutes=-2;seconds=-3).
     * @type {string}
     * @memberof SAMLProvider
     */
    assertionValidNotBefore?: string;
    /**
     * Assertion not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof SAMLProvider
     */
    assertionValidNotOnOrAfter?: string;
    /**
     * Session not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof SAMLProvider
     */
    sessionValidNotOnOrAfter?: string;
    /**
     * Configure how the NameID value will be created. When left empty, the NameIDPolicy of the incoming request will be considered
     * @type {string}
     * @memberof SAMLProvider
     */
    nameIdMapping?: string | null;
    /**
     * Configure how the AuthnContextClassRef value will be created. When left empty, the AuthnContextClassRef will be set based on which authentication methods the user used to authenticate.
     * @type {string}
     * @memberof SAMLProvider
     */
    authnContextClassRefMapping?: string | null;
    /**
     * 
     * @type {DigestAlgorithmEnum}
     * @memberof SAMLProvider
     */
    digestAlgorithm?: DigestAlgorithmEnum;
    /**
     * 
     * @type {SignatureAlgorithmEnum}
     * @memberof SAMLProvider
     */
    signatureAlgorithm?: SignatureAlgorithmEnum;
    /**
     * Keypair used to sign outgoing Responses going to the Service Provider.
     * @type {string}
     * @memberof SAMLProvider
     */
    signingKp?: string | null;
    /**
     * When selected, incoming assertion's Signatures will be validated against this certificate. To allow unsigned Requests, leave on default.
     * @type {string}
     * @memberof SAMLProvider
     */
    verificationKp?: string | null;
    /**
     * 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 SAMLProvider
     */
    encryptionKp?: string | null;
    /**
     * 
     * @type {boolean}
     * @memberof SAMLProvider
     */
    signAssertion?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof SAMLProvider
     */
    signResponse?: boolean;
    /**
     * This determines how authentik sends the response back to the Service Provider.
     * @type {SpBindingEnum}
     * @memberof SAMLProvider
     */
    spBinding?: SpBindingEnum;
    /**
     * Default relay_state value for IDP-initiated logins
     * @type {string}
     * @memberof SAMLProvider
     */
    defaultRelayState?: string;
    /**
     * 
     * @type {SAMLNameIDPolicyEnum}
     * @memberof SAMLProvider
     */
    defaultNameIdPolicy?: SAMLNameIDPolicyEnum;
    /**
     * Get metadata download URL
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly urlDownloadMetadata: string;
    /**
     * Get SSO Post URL
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly urlSsoPost: string;
    /**
     * Get SSO Redirect URL
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly urlSsoRedirect: string;
    /**
     * Get SSO IDP-Initiated URL
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly urlSsoInit: string;
    /**
     * Get SLO POST URL
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly urlSloPost: string;
    /**
     * Get SLO redirect URL
     * @type {string}
     * @memberof SAMLProvider
     */
    readonly urlSloRedirect: string;
}



/**
 * Check if a given object implements the SAMLProvider interface.
 */
export function instanceOfSAMLProvider(value: object): value is SAMLProvider {
    if (!('pk' in value) || value['pk'] === undefined) return false;
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('authorizationFlow' in value) || value['authorizationFlow'] === undefined) return false;
    if (!('invalidationFlow' in value) || value['invalidationFlow'] === undefined) return false;
    if (!('component' in value) || value['component'] === undefined) return false;
    if (!('assignedApplicationSlug' in value) || value['assignedApplicationSlug'] === undefined) return false;
    if (!('assignedApplicationName' in value) || value['assignedApplicationName'] === undefined) return false;
    if (!('assignedBackchannelApplicationSlug' in value) || value['assignedBackchannelApplicationSlug'] === undefined) return false;
    if (!('assignedBackchannelApplicationName' in value) || value['assignedBackchannelApplicationName'] === 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 (!('acsUrl' in value) || value['acsUrl'] === undefined) return false;
    if (!('urlDownloadMetadata' in value) || value['urlDownloadMetadata'] === undefined) return false;
    if (!('urlSsoPost' in value) || value['urlSsoPost'] === undefined) return false;
    if (!('urlSsoRedirect' in value) || value['urlSsoRedirect'] === undefined) return false;
    if (!('urlSsoInit' in value) || value['urlSsoInit'] === undefined) return false;
    if (!('urlSloPost' in value) || value['urlSloPost'] === undefined) return false;
    if (!('urlSloRedirect' in value) || value['urlSloRedirect'] === undefined) return false;
    return true;
}

export function SAMLProviderFromJSON(json: any): SAMLProvider {
    return SAMLProviderFromJSONTyped(json, false);
}

export function SAMLProviderFromJSONTyped(json: any, ignoreDiscriminator: boolean): SAMLProvider {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'name': json['name'],
        'authenticationFlow': json['authentication_flow'] == null ? undefined : json['authentication_flow'],
        'authorizationFlow': json['authorization_flow'],
        'invalidationFlow': json['invalidation_flow'],
        'propertyMappings': json['property_mappings'] == null ? undefined : json['property_mappings'],
        'component': json['component'],
        'assignedApplicationSlug': json['assigned_application_slug'],
        'assignedApplicationName': json['assigned_application_name'],
        'assignedBackchannelApplicationSlug': json['assigned_backchannel_application_slug'],
        'assignedBackchannelApplicationName': json['assigned_backchannel_application_name'],
        'verboseName': json['verbose_name'],
        'verboseNamePlural': json['verbose_name_plural'],
        'metaModelName': json['meta_model_name'],
        'acsUrl': json['acs_url'],
        'audience': json['audience'] == null ? undefined : json['audience'],
        'issuer': json['issuer'] == null ? undefined : json['issuer'],
        'assertionValidNotBefore': json['assertion_valid_not_before'] == null ? undefined : json['assertion_valid_not_before'],
        'assertionValidNotOnOrAfter': json['assertion_valid_not_on_or_after'] == null ? undefined : json['assertion_valid_not_on_or_after'],
        'sessionValidNotOnOrAfter': json['session_valid_not_on_or_after'] == null ? undefined : json['session_valid_not_on_or_after'],
        'nameIdMapping': json['name_id_mapping'] == null ? undefined : json['name_id_mapping'],
        'authnContextClassRefMapping': json['authn_context_class_ref_mapping'] == null ? undefined : json['authn_context_class_ref_mapping'],
        'digestAlgorithm': json['digest_algorithm'] == null ? undefined : DigestAlgorithmEnumFromJSON(json['digest_algorithm']),
        'signatureAlgorithm': json['signature_algorithm'] == null ? undefined : SignatureAlgorithmEnumFromJSON(json['signature_algorithm']),
        'signingKp': json['signing_kp'] == null ? undefined : json['signing_kp'],
        'verificationKp': json['verification_kp'] == null ? undefined : json['verification_kp'],
        'encryptionKp': json['encryption_kp'] == null ? undefined : json['encryption_kp'],
        'signAssertion': json['sign_assertion'] == null ? undefined : json['sign_assertion'],
        'signResponse': json['sign_response'] == null ? undefined : json['sign_response'],
        'spBinding': json['sp_binding'] == null ? undefined : SpBindingEnumFromJSON(json['sp_binding']),
        'defaultRelayState': json['default_relay_state'] == null ? undefined : json['default_relay_state'],
        'defaultNameIdPolicy': json['default_name_id_policy'] == null ? undefined : SAMLNameIDPolicyEnumFromJSON(json['default_name_id_policy']),
        'urlDownloadMetadata': json['url_download_metadata'],
        'urlSsoPost': json['url_sso_post'],
        'urlSsoRedirect': json['url_sso_redirect'],
        'urlSsoInit': json['url_sso_init'],
        'urlSloPost': json['url_slo_post'],
        'urlSloRedirect': json['url_slo_redirect'],
    };
}

export function SAMLProviderToJSON(json: any): SAMLProvider {
    return SAMLProviderToJSONTyped(json, false);
}

export function SAMLProviderToJSONTyped(value?: Omit<SAMLProvider, 'pk'|'component'|'assigned_application_slug'|'assigned_application_name'|'assigned_backchannel_application_slug'|'assigned_backchannel_application_name'|'verbose_name'|'verbose_name_plural'|'meta_model_name'|'url_download_metadata'|'url_sso_post'|'url_sso_redirect'|'url_sso_init'|'url_slo_post'|'url_slo_redirect'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'authentication_flow': value['authenticationFlow'],
        'authorization_flow': value['authorizationFlow'],
        'invalidation_flow': value['invalidationFlow'],
        'property_mappings': value['propertyMappings'],
        'acs_url': value['acsUrl'],
        'audience': value['audience'],
        'issuer': value['issuer'],
        'assertion_valid_not_before': value['assertionValidNotBefore'],
        'assertion_valid_not_on_or_after': value['assertionValidNotOnOrAfter'],
        'session_valid_not_on_or_after': value['sessionValidNotOnOrAfter'],
        'name_id_mapping': value['nameIdMapping'],
        'authn_context_class_ref_mapping': value['authnContextClassRefMapping'],
        'digest_algorithm': DigestAlgorithmEnumToJSON(value['digestAlgorithm']),
        'signature_algorithm': SignatureAlgorithmEnumToJSON(value['signatureAlgorithm']),
        'signing_kp': value['signingKp'],
        'verification_kp': value['verificationKp'],
        'encryption_kp': value['encryptionKp'],
        'sign_assertion': value['signAssertion'],
        'sign_response': value['signResponse'],
        'sp_binding': SpBindingEnumToJSON(value['spBinding']),
        'default_relay_state': value['defaultRelayState'],
        'default_name_id_policy': SAMLNameIDPolicyEnumToJSON(value['defaultNameIdPolicy']),
    };
}

