/* 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 { FlowSet } from "./FlowSet";
import { FlowSetFromJSON } from "./FlowSet";

/**
 * CaptchaStage Serializer
 * @export
 * @interface CaptchaStage
 */
export interface CaptchaStage {
    /**
     *
     * @type {string}
     * @memberof CaptchaStage
     */
    readonly pk: string;
    /**
     *
     * @type {string}
     * @memberof CaptchaStage
     */
    name: string;
    /**
     * Get object type so that we know how to edit the object
     * @type {string}
     * @memberof CaptchaStage
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof CaptchaStage
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof CaptchaStage
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof CaptchaStage
     */
    readonly metaModelName: string;
    /**
     *
     * @type {Array<FlowSet>}
     * @memberof CaptchaStage
     */
    readonly flowSet: Array<FlowSet>;
    /**
     * Public key, acquired your captcha Provider.
     * @type {string}
     * @memberof CaptchaStage
     */
    publicKey: string;
    /**
     *
     * @type {string}
     * @memberof CaptchaStage
     */
    jsUrl?: string;
    /**
     *
     * @type {string}
     * @memberof CaptchaStage
     */
    apiUrl?: string;
    /**
     *
     * @type {boolean}
     * @memberof CaptchaStage
     */
    interactive?: boolean;
    /**
     *
     * @type {number}
     * @memberof CaptchaStage
     */
    scoreMinThreshold?: number;
    /**
     *
     * @type {number}
     * @memberof CaptchaStage
     */
    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 CaptchaStage
     */
    errorOnInvalidScore?: boolean;
}

/**
 * Check if a given object implements the CaptchaStage interface.
 */
export function instanceOfCaptchaStage(value: object): value is CaptchaStage {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("component" in value) || value["component"] === undefined) return false;
    if (!("verboseName" in value) || value["verboseName"] === undefined) return false;
    if (!("verboseNamePlural" in value) || value["verboseNamePlural"] === undefined) return false;
    if (!("metaModelName" in value) || value["metaModelName"] === undefined) return false;
    if (!("flowSet" in value) || value["flowSet"] === undefined) return false;
    if (!("publicKey" in value) || value["publicKey"] === undefined) return false;
    return true;
}

export function CaptchaStageFromJSON(json: any): CaptchaStage {
    return CaptchaStageFromJSONTyped(json, false);
}

export function CaptchaStageFromJSONTyped(json: any, ignoreDiscriminator: boolean): CaptchaStage {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        component: json["component"],
        verboseName: json["verbose_name"],
        verboseNamePlural: json["verbose_name_plural"],
        metaModelName: json["meta_model_name"],
        flowSet: (json["flow_set"] as Array<any>).map(FlowSetFromJSON),
        publicKey: json["public_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 CaptchaStageToJSON(json: any): CaptchaStage {
    return CaptchaStageToJSONTyped(json, false);
}

export function CaptchaStageToJSONTyped(
    value?: Omit<
        CaptchaStage,
        "pk" | "component" | "verbose_name" | "verbose_name_plural" | "meta_model_name" | "flow_set"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        public_key: value["publicKey"],
        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"],
    };
}
