/* 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 { ErrorDetail } from './ErrorDetail';
import {
    ErrorDetailFromJSON,
    ErrorDetailFromJSONTyped,
    ErrorDetailToJSON,
    ErrorDetailToJSONTyped,
} from './ErrorDetail';
import type { ContextualFlowInfo } from './ContextualFlowInfo';
import {
    ContextualFlowInfoFromJSON,
    ContextualFlowInfoFromJSONTyped,
    ContextualFlowInfoToJSON,
    ContextualFlowInfoToJSONTyped,
} from './ContextualFlowInfo';
import type { FlowDesignationEnum } from './FlowDesignationEnum';
import {
    FlowDesignationEnumFromJSON,
    FlowDesignationEnumFromJSONTyped,
    FlowDesignationEnumToJSON,
    FlowDesignationEnumToJSONTyped,
} from './FlowDesignationEnum';
import type { LoginSource } from './LoginSource';
import {
    LoginSourceFromJSON,
    LoginSourceFromJSONTyped,
    LoginSourceToJSON,
    LoginSourceToJSONTyped,
} from './LoginSource';
import type { CaptchaChallenge } from './CaptchaChallenge';
import {
    CaptchaChallengeFromJSON,
    CaptchaChallengeFromJSONTyped,
    CaptchaChallengeToJSON,
    CaptchaChallengeToJSONTyped,
} from './CaptchaChallenge';

/**
 * Identification challenges with all UI elements
 * @export
 * @interface IdentificationChallenge
 */
export interface IdentificationChallenge {
    /**
     * 
     * @type {ContextualFlowInfo}
     * @memberof IdentificationChallenge
     */
    flowInfo?: ContextualFlowInfo;
    /**
     * 
     * @type {string}
     * @memberof IdentificationChallenge
     */
    component?: string;
    /**
     * 
     * @type {{ [key: string]: Array<ErrorDetail>; }}
     * @memberof IdentificationChallenge
     */
    responseErrors?: { [key: string]: Array<ErrorDetail>; };
    /**
     * 
     * @type {Array<string>}
     * @memberof IdentificationChallenge
     */
    userFields: Array<string> | null;
    /**
     * 
     * @type {boolean}
     * @memberof IdentificationChallenge
     */
    passwordFields: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof IdentificationChallenge
     */
    allowShowPassword?: boolean;
    /**
     * 
     * @type {string}
     * @memberof IdentificationChallenge
     */
    applicationPre?: string;
    /**
     * 
     * @type {FlowDesignationEnum}
     * @memberof IdentificationChallenge
     */
    flowDesignation: FlowDesignationEnum;
    /**
     * 
     * @type {CaptchaChallenge}
     * @memberof IdentificationChallenge
     */
    captchaStage?: CaptchaChallenge | null;
    /**
     * 
     * @type {string}
     * @memberof IdentificationChallenge
     */
    enrollUrl?: string;
    /**
     * 
     * @type {string}
     * @memberof IdentificationChallenge
     */
    recoveryUrl?: string;
    /**
     * 
     * @type {string}
     * @memberof IdentificationChallenge
     */
    passwordlessUrl?: string;
    /**
     * 
     * @type {string}
     * @memberof IdentificationChallenge
     */
    primaryAction: string;
    /**
     * 
     * @type {Array<LoginSource>}
     * @memberof IdentificationChallenge
     */
    sources?: Array<LoginSource>;
    /**
     * 
     * @type {boolean}
     * @memberof IdentificationChallenge
     */
    showSourceLabels: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof IdentificationChallenge
     */
    enableRememberMe?: boolean;
}



/**
 * Check if a given object implements the IdentificationChallenge interface.
 */
export function instanceOfIdentificationChallenge(value: object): value is IdentificationChallenge {
    if (!('userFields' in value) || value['userFields'] === undefined) return false;
    if (!('passwordFields' in value) || value['passwordFields'] === undefined) return false;
    if (!('flowDesignation' in value) || value['flowDesignation'] === undefined) return false;
    if (!('primaryAction' in value) || value['primaryAction'] === undefined) return false;
    if (!('showSourceLabels' in value) || value['showSourceLabels'] === undefined) return false;
    return true;
}

export function IdentificationChallengeFromJSON(json: any): IdentificationChallenge {
    return IdentificationChallengeFromJSONTyped(json, false);
}

export function IdentificationChallengeFromJSONTyped(json: any, ignoreDiscriminator: boolean): IdentificationChallenge {
    if (json == null) {
        return json;
    }
    return {
        
        'flowInfo': json['flow_info'] == null ? undefined : ContextualFlowInfoFromJSON(json['flow_info']),
        'component': json['component'] == null ? undefined : json['component'],
        'responseErrors': json['response_errors'] == null ? undefined : json['response_errors'],
        'userFields': json['user_fields'] == null ? null : json['user_fields'],
        'passwordFields': json['password_fields'],
        'allowShowPassword': json['allow_show_password'] == null ? undefined : json['allow_show_password'],
        'applicationPre': json['application_pre'] == null ? undefined : json['application_pre'],
        'flowDesignation': FlowDesignationEnumFromJSON(json['flow_designation']),
        'captchaStage': json['captcha_stage'] == null ? undefined : CaptchaChallengeFromJSON(json['captcha_stage']),
        'enrollUrl': json['enroll_url'] == null ? undefined : json['enroll_url'],
        'recoveryUrl': json['recovery_url'] == null ? undefined : json['recovery_url'],
        'passwordlessUrl': json['passwordless_url'] == null ? undefined : json['passwordless_url'],
        'primaryAction': json['primary_action'],
        'sources': json['sources'] == null ? undefined : ((json['sources'] as Array<any>).map(LoginSourceFromJSON)),
        'showSourceLabels': json['show_source_labels'],
        'enableRememberMe': json['enable_remember_me'] == null ? undefined : json['enable_remember_me'],
    };
}

export function IdentificationChallengeToJSON(json: any): IdentificationChallenge {
    return IdentificationChallengeToJSONTyped(json, false);
}

export function IdentificationChallengeToJSONTyped(value?: IdentificationChallenge | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'flow_info': ContextualFlowInfoToJSON(value['flowInfo']),
        'component': value['component'],
        'response_errors': value['responseErrors'],
        'user_fields': value['userFields'],
        'password_fields': value['passwordFields'],
        'allow_show_password': value['allowShowPassword'],
        'application_pre': value['applicationPre'],
        'flow_designation': FlowDesignationEnumToJSON(value['flowDesignation']),
        'captcha_stage': CaptchaChallengeToJSON(value['captchaStage']),
        'enroll_url': value['enrollUrl'],
        'recovery_url': value['recoveryUrl'],
        'passwordless_url': value['passwordlessUrl'],
        'primary_action': value['primaryAction'],
        'sources': value['sources'] == null ? undefined : ((value['sources'] as Array<any>).map(LoginSourceToJSON)),
        'show_source_labels': value['showSourceLabels'],
        'enable_remember_me': value['enableRememberMe'],
    };
}

