/* 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 { FlowSetRequest } from './FlowSetRequest';
import {
    FlowSetRequestFromJSON,
    FlowSetRequestFromJSONTyped,
    FlowSetRequestToJSON,
    FlowSetRequestToJSONTyped,
} from './FlowSetRequest';

/**
 * CaptchaStage Serializer
 * @export
 * @interface PatchedCaptchaStageRequest
 */
export interface PatchedCaptchaStageRequest {
    /**
     * 
     * @type {string}
     * @memberof PatchedCaptchaStageRequest
     */
    name?: string;
    /**
     * 
     * @type {Array<FlowSetRequest>}
     * @memberof PatchedCaptchaStageRequest
     */
    flowSet?: Array<FlowSetRequest>;
    /**
     * Public key, acquired your captcha Provider.
     * @type {string}
     * @memberof PatchedCaptchaStageRequest
     */
    publicKey?: string;
    /**
     * Private key, acquired your captcha Provider.
     * @type {string}
     * @memberof PatchedCaptchaStageRequest
     */
    privateKey?: string;
    /**
     * 
     * @type {string}
     * @memberof PatchedCaptchaStageRequest
     */
    jsUrl?: string;
    /**
     * 
     * @type {string}
     * @memberof PatchedCaptchaStageRequest
     */
    apiUrl?: string;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedCaptchaStageRequest
     */
    interactive?: boolean;
    /**
     * 
     * @type {number}
     * @memberof PatchedCaptchaStageRequest
     */
    scoreMinThreshold?: number;
    /**
     * 
     * @type {number}
     * @memberof PatchedCaptchaStageRequest
     */
    scoreMaxThreshold?: number;
    /**
     * When enabled and the received captcha score is outside of the given threshold, the stage will show an error message. When not enabled, the flow will continue, but the data from the captcha will be available in the context for policy decisions
     * @type {boolean}
     * @memberof PatchedCaptchaStageRequest
     */
    errorOnInvalidScore?: boolean;
}

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

export function PatchedCaptchaStageRequestFromJSON(json: any): PatchedCaptchaStageRequest {
    return PatchedCaptchaStageRequestFromJSONTyped(json, false);
}

export function PatchedCaptchaStageRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedCaptchaStageRequest {
    if (json == null) {
        return json;
    }
    return {
        
        'name': json['name'] == null ? undefined : json['name'],
        'flowSet': json['flow_set'] == null ? undefined : ((json['flow_set'] as Array<any>).map(FlowSetRequestFromJSON)),
        'publicKey': json['public_key'] == null ? undefined : json['public_key'],
        'privateKey': json['private_key'] == null ? undefined : json['private_key'],
        'jsUrl': json['js_url'] == null ? undefined : json['js_url'],
        'apiUrl': json['api_url'] == null ? undefined : json['api_url'],
        'interactive': json['interactive'] == null ? undefined : json['interactive'],
        'scoreMinThreshold': json['score_min_threshold'] == null ? undefined : json['score_min_threshold'],
        'scoreMaxThreshold': json['score_max_threshold'] == null ? undefined : json['score_max_threshold'],
        'errorOnInvalidScore': json['error_on_invalid_score'] == null ? undefined : json['error_on_invalid_score'],
    };
}

export function PatchedCaptchaStageRequestToJSON(json: any): PatchedCaptchaStageRequest {
    return PatchedCaptchaStageRequestToJSONTyped(json, false);
}

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

    return {
        
        'name': value['name'],
        'flow_set': value['flowSet'] == null ? undefined : ((value['flowSet'] as Array<any>).map(FlowSetRequestToJSON)),
        'public_key': value['publicKey'],
        'private_key': value['privateKey'],
        'js_url': value['jsUrl'],
        'api_url': value['apiUrl'],
        'interactive': value['interactive'],
        'score_min_threshold': value['scoreMinThreshold'],
        'score_max_threshold': value['scoreMaxThreshold'],
        'error_on_invalid_score': value['errorOnInvalidScore'],
    };
}

