/* 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 { UserFieldsEnum } from "./UserFieldsEnum";
import { UserFieldsEnumFromJSON, UserFieldsEnumToJSON } from "./UserFieldsEnum";

/**
 * IdentificationStage Serializer
 * @export
 * @interface PatchedIdentificationStageRequest
 */
export interface PatchedIdentificationStageRequest {
    /**
     *
     * @type {string}
     * @memberof PatchedIdentificationStageRequest
     */
    name?: string;
    /**
     * Fields of the user object to match against. (Hold shift to select multiple options)
     * @type {Array<UserFieldsEnum>}
     * @memberof PatchedIdentificationStageRequest
     */
    userFields?: Array<UserFieldsEnum>;
    /**
     * When set, shows a password field, instead of showing the password field as separate step.
     * @type {string}
     * @memberof PatchedIdentificationStageRequest
     */
    passwordStage?: string | null;
    /**
     * When set, adds functionality exactly like a Captcha stage, but baked into the Identification stage.
     * @type {string}
     * @memberof PatchedIdentificationStageRequest
     */
    captchaStage?: string | null;
    /**
     * When enabled, user fields are matched regardless of their casing.
     * @type {boolean}
     * @memberof PatchedIdentificationStageRequest
     */
    caseInsensitiveMatching?: boolean;
    /**
     * When a valid username/email has been entered, and this option is enabled, the user's username and avatar will be shown. Otherwise, the text that the user entered will be shown
     * @type {boolean}
     * @memberof PatchedIdentificationStageRequest
     */
    showMatchedUser?: boolean;
    /**
     * Optional enrollment flow, which is linked at the bottom of the page.
     * @type {string}
     * @memberof PatchedIdentificationStageRequest
     */
    enrollmentFlow?: string | null;
    /**
     * Optional recovery flow, which is linked at the bottom of the page.
     * @type {string}
     * @memberof PatchedIdentificationStageRequest
     */
    recoveryFlow?: string | null;
    /**
     * Optional passwordless flow, which is linked at the bottom of the page.
     * @type {string}
     * @memberof PatchedIdentificationStageRequest
     */
    passwordlessFlow?: string | null;
    /**
     * Specify which sources should be shown.
     * @type {Array<string>}
     * @memberof PatchedIdentificationStageRequest
     */
    sources?: Array<string>;
    /**
     *
     * @type {boolean}
     * @memberof PatchedIdentificationStageRequest
     */
    showSourceLabels?: boolean;
    /**
     * When enabled, the stage will succeed and continue even when incorrect user info is entered.
     * @type {boolean}
     * @memberof PatchedIdentificationStageRequest
     */
    pretendUserExists?: boolean;
    /**
     * Show the user the 'Remember me on this device' toggle, allowing repeat users to skip straight to entering their password.
     * @type {boolean}
     * @memberof PatchedIdentificationStageRequest
     */
    enableRememberMe?: boolean;
    /**
     * When set, and conditional WebAuthn is available, allow the user to use their passkey as a first factor.
     * @type {string}
     * @memberof PatchedIdentificationStageRequest
     */
    webauthnStage?: string | null;
}

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

export function PatchedIdentificationStageRequestFromJSON(
    json: any,
): PatchedIdentificationStageRequest {
    return PatchedIdentificationStageRequestFromJSONTyped(json, false);
}

export function PatchedIdentificationStageRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedIdentificationStageRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : json["name"],
        userFields:
            json["user_fields"] == null
                ? undefined
                : (json["user_fields"] as Array<any>).map(UserFieldsEnumFromJSON),
        passwordStage: json["password_stage"] == null ? undefined : json["password_stage"],
        captchaStage: json["captcha_stage"] == null ? undefined : json["captcha_stage"],
        caseInsensitiveMatching:
            json["case_insensitive_matching"] == null
                ? undefined
                : json["case_insensitive_matching"],
        showMatchedUser: json["show_matched_user"] == null ? undefined : json["show_matched_user"],
        enrollmentFlow: json["enrollment_flow"] == null ? undefined : json["enrollment_flow"],
        recoveryFlow: json["recovery_flow"] == null ? undefined : json["recovery_flow"],
        passwordlessFlow: json["passwordless_flow"] == null ? undefined : json["passwordless_flow"],
        sources: json["sources"] == null ? undefined : json["sources"],
        showSourceLabels:
            json["show_source_labels"] == null ? undefined : json["show_source_labels"],
        pretendUserExists:
            json["pretend_user_exists"] == null ? undefined : json["pretend_user_exists"],
        enableRememberMe:
            json["enable_remember_me"] == null ? undefined : json["enable_remember_me"],
        webauthnStage: json["webauthn_stage"] == null ? undefined : json["webauthn_stage"],
    };
}

export function PatchedIdentificationStageRequestToJSON(
    json: any,
): PatchedIdentificationStageRequest {
    return PatchedIdentificationStageRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        user_fields:
            value["userFields"] == null
                ? undefined
                : (value["userFields"] as Array<any>).map(UserFieldsEnumToJSON),
        password_stage: value["passwordStage"],
        captcha_stage: value["captchaStage"],
        case_insensitive_matching: value["caseInsensitiveMatching"],
        show_matched_user: value["showMatchedUser"],
        enrollment_flow: value["enrollmentFlow"],
        recovery_flow: value["recoveryFlow"],
        passwordless_flow: value["passwordlessFlow"],
        sources: value["sources"],
        show_source_labels: value["showSourceLabels"],
        pretend_user_exists: value["pretendUserExists"],
        enable_remember_me: value["enableRememberMe"],
        webauthn_stage: value["webauthnStage"],
    };
}
