/* 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';

/**
 * Challenge class when an unhandled error occurs during a stage. Normal users
 * are shown an error message, superusers are shown a full stacktrace.
 * @export
 * @interface FlowErrorChallenge
 */
export interface FlowErrorChallenge {
    /**
     * 
     * @type {ContextualFlowInfo}
     * @memberof FlowErrorChallenge
     */
    flowInfo?: ContextualFlowInfo;
    /**
     * 
     * @type {string}
     * @memberof FlowErrorChallenge
     */
    component?: string;
    /**
     * 
     * @type {{ [key: string]: Array<ErrorDetail>; }}
     * @memberof FlowErrorChallenge
     */
    responseErrors?: { [key: string]: Array<ErrorDetail>; };
    /**
     * 
     * @type {string}
     * @memberof FlowErrorChallenge
     */
    requestId: string;
    /**
     * 
     * @type {string}
     * @memberof FlowErrorChallenge
     */
    error?: string;
    /**
     * 
     * @type {string}
     * @memberof FlowErrorChallenge
     */
    traceback?: string;
}

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

export function FlowErrorChallengeFromJSON(json: any): FlowErrorChallenge {
    return FlowErrorChallengeFromJSONTyped(json, false);
}

export function FlowErrorChallengeFromJSONTyped(json: any, ignoreDiscriminator: boolean): FlowErrorChallenge {
    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'],
        'requestId': json['request_id'],
        'error': json['error'] == null ? undefined : json['error'],
        'traceback': json['traceback'] == null ? undefined : json['traceback'],
    };
}

export function FlowErrorChallengeToJSON(json: any): FlowErrorChallenge {
    return FlowErrorChallengeToJSONTyped(json, false);
}

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

    return {
        
        'flow_info': ContextualFlowInfoToJSON(value['flowInfo']),
        'component': value['component'],
        'response_errors': value['responseErrors'],
        'request_id': value['requestId'],
        'error': value['error'],
        'traceback': value['traceback'],
    };
}

