/* 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 { ErrorDetail } from './ErrorDetail';
import {
    ErrorDetailFromJSON,
    ErrorDetailFromJSONTyped,
    ErrorDetailToJSON,
    ErrorDetailToJSONTyped,
} from './ErrorDetail';
import type { ContextualFlowInfo } from './ContextualFlowInfo';
import {
    ContextualFlowInfoFromJSON,
    ContextualFlowInfoFromJSONTyped,
    ContextualFlowInfoToJSON,
    ContextualFlowInfoToJSONTyped,
} from './ContextualFlowInfo';
import type { StagePrompt } from './StagePrompt';
import {
    StagePromptFromJSON,
    StagePromptFromJSONTyped,
    StagePromptToJSON,
    StagePromptToJSONTyped,
} from './StagePrompt';

/**
 * Initial challenge being sent, define fields
 * @export
 * @interface PromptChallenge
 */
export interface PromptChallenge {
    /**
     * 
     * @type {ContextualFlowInfo}
     * @memberof PromptChallenge
     */
    flowInfo?: ContextualFlowInfo;
    /**
     * 
     * @type {string}
     * @memberof PromptChallenge
     */
    component?: string;
    /**
     * 
     * @type {{ [key: string]: Array<ErrorDetail>; }}
     * @memberof PromptChallenge
     */
    responseErrors?: { [key: string]: Array<ErrorDetail>; };
    /**
     * 
     * @type {Array<StagePrompt>}
     * @memberof PromptChallenge
     */
    fields: Array<StagePrompt>;
}

/**
 * Check if a given object implements the PromptChallenge interface.
 */
export function instanceOfPromptChallenge(value: object): value is PromptChallenge {
    if (!('fields' in value) || value['fields'] === undefined) return false;
    return true;
}

export function PromptChallengeFromJSON(json: any): PromptChallenge {
    return PromptChallengeFromJSONTyped(json, false);
}

export function PromptChallengeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PromptChallenge {
    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'],
        'fields': ((json['fields'] as Array<any>).map(StagePromptFromJSON)),
    };
}

export function PromptChallengeToJSON(json: any): PromptChallenge {
    return PromptChallengeToJSONTyped(json, false);
}

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

    return {
        
        'flow_info': ContextualFlowInfoToJSON(value['flowInfo']),
        'component': value['component'],
        'response_errors': value['responseErrors'],
        'fields': ((value['fields'] as Array<any>).map(StagePromptToJSON)),
    };
}

