/* 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 { DigestAlgorithmEnum } from "./DigestAlgorithmEnum";
import { DigestAlgorithmEnumFromJSON, DigestAlgorithmEnumToJSON } from "./DigestAlgorithmEnum";
import type { SAMLBindingsEnum } from "./SAMLBindingsEnum";
import { SAMLBindingsEnumFromJSON, SAMLBindingsEnumToJSON } from "./SAMLBindingsEnum";
import type { SAMLLogoutMethods } from "./SAMLLogoutMethods";
import { SAMLLogoutMethodsFromJSON, SAMLLogoutMethodsToJSON } from "./SAMLLogoutMethods";
import type { SAMLNameIDPolicyEnum } from "./SAMLNameIDPolicyEnum";
import { SAMLNameIDPolicyEnumFromJSON, SAMLNameIDPolicyEnumToJSON } from "./SAMLNameIDPolicyEnum";
import type { SignatureAlgorithmEnum } from "./SignatureAlgorithmEnum";
import {
    SignatureAlgorithmEnumFromJSON,
    SignatureAlgorithmEnumToJSON,
} from "./SignatureAlgorithmEnum";

/**
 * SAMLProvider Serializer
 * @export
 * @interface PatchedSAMLProviderRequest
 */
export interface PatchedSAMLProviderRequest {
    /**
     *
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    name?: string;
    /**
     * Flow used for authentication when the associated application is accessed by an un-authenticated user.
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow used when authorizing this provider.
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    authorizationFlow?: string;
    /**
     * Flow used ending the session from a provider.
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    invalidationFlow?: string;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedSAMLProviderRequest
     */
    propertyMappings?: Array<string>;
    /**
     *
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    acsUrl?: string;
    /**
     * Single Logout Service URL where the logout response should be sent.
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    slsUrl?: string;
    /**
     * Value of the audience restriction field of the assertion. When left empty, no audience restriction will be added.
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    audience?: string;
    /**
     * Also known as EntityID
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    issuer?: string;
    /**
     * Assertion valid not before current time + this value (Format: hours=-1;minutes=-2;seconds=-3).
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    assertionValidNotBefore?: string;
    /**
     * Assertion not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    assertionValidNotOnOrAfter?: string;
    /**
     * Session not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    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 PatchedSAMLProviderRequest
     */
    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 PatchedSAMLProviderRequest
     */
    authnContextClassRefMapping?: string | null;
    /**
     *
     * @type {DigestAlgorithmEnum}
     * @memberof PatchedSAMLProviderRequest
     */
    digestAlgorithm?: DigestAlgorithmEnum;
    /**
     *
     * @type {SignatureAlgorithmEnum}
     * @memberof PatchedSAMLProviderRequest
     */
    signatureAlgorithm?: SignatureAlgorithmEnum;
    /**
     * Keypair used to sign outgoing Responses going to the Service Provider.
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    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 PatchedSAMLProviderRequest
     */
    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 PatchedSAMLProviderRequest
     */
    encryptionKp?: string | null;
    /**
     *
     * @type {boolean}
     * @memberof PatchedSAMLProviderRequest
     */
    signAssertion?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof PatchedSAMLProviderRequest
     */
    signResponse?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof PatchedSAMLProviderRequest
     */
    signLogoutRequest?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof PatchedSAMLProviderRequest
     */
    signLogoutResponse?: boolean;
    /**
     * This determines how authentik sends the response back to the Service Provider.
     * @type {SAMLBindingsEnum}
     * @memberof PatchedSAMLProviderRequest
     */
    spBinding?: SAMLBindingsEnum;
    /**
     * This determines how authentik sends the logout response back to the Service Provider.
     * @type {SAMLBindingsEnum}
     * @memberof PatchedSAMLProviderRequest
     */
    slsBinding?: SAMLBindingsEnum;
    /**
     * Method to use for logout. Front-channel iframe loads all logout URLs simultaneously in hidden iframes. Front-channel native uses your active browser tab to send post requests and redirect to providers. Back-channel sends logout requests directly from the server without user interaction (requires POST SLS binding).
     * @type {SAMLLogoutMethods}
     * @memberof PatchedSAMLProviderRequest
     */
    logoutMethod?: SAMLLogoutMethods;
    /**
     * Default relay_state value for IDP-initiated logins
     * @type {string}
     * @memberof PatchedSAMLProviderRequest
     */
    defaultRelayState?: string;
    /**
     *
     * @type {SAMLNameIDPolicyEnum}
     * @memberof PatchedSAMLProviderRequest
     */
    defaultNameIdPolicy?: SAMLNameIDPolicyEnum;
}

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

export function PatchedSAMLProviderRequestFromJSON(json: any): PatchedSAMLProviderRequest {
    return PatchedSAMLProviderRequestFromJSONTyped(json, false);
}

export function PatchedSAMLProviderRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedSAMLProviderRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : json["name"],
        authenticationFlow:
            json["authentication_flow"] == null ? undefined : json["authentication_flow"],
        authorizationFlow:
            json["authorization_flow"] == null ? undefined : json["authorization_flow"],
        invalidationFlow: json["invalidation_flow"] == null ? undefined : json["invalidation_flow"],
        propertyMappings: json["property_mappings"] == null ? undefined : json["property_mappings"],
        acsUrl: json["acs_url"] == null ? undefined : json["acs_url"],
        slsUrl: json["sls_url"] == null ? undefined : json["sls_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"],
        signLogoutRequest:
            json["sign_logout_request"] == null ? undefined : json["sign_logout_request"],
        signLogoutResponse:
            json["sign_logout_response"] == null ? undefined : json["sign_logout_response"],
        spBinding:
            json["sp_binding"] == null ? undefined : SAMLBindingsEnumFromJSON(json["sp_binding"]),
        slsBinding:
            json["sls_binding"] == null ? undefined : SAMLBindingsEnumFromJSON(json["sls_binding"]),
        logoutMethod:
            json["logout_method"] == null
                ? undefined
                : SAMLLogoutMethodsFromJSON(json["logout_method"]),
        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"]),
    };
}

export function PatchedSAMLProviderRequestToJSON(json: any): PatchedSAMLProviderRequest {
    return PatchedSAMLProviderRequestToJSONTyped(json, false);
}

export function PatchedSAMLProviderRequestToJSONTyped(
    value?: PatchedSAMLProviderRequest | 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"],
        sls_url: value["slsUrl"],
        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"],
        sign_logout_request: value["signLogoutRequest"],
        sign_logout_response: value["signLogoutResponse"],
        sp_binding: SAMLBindingsEnumToJSON(value["spBinding"]),
        sls_binding: SAMLBindingsEnumToJSON(value["slsBinding"]),
        logout_method: SAMLLogoutMethodsToJSON(value["logoutMethod"]),
        default_relay_state: value["defaultRelayState"],
        default_name_id_policy: SAMLNameIDPolicyEnumToJSON(value["defaultNameIdPolicy"]),
    };
}
