/* 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 { AuthenticatorAttachmentEnum } from "./AuthenticatorAttachmentEnum";
import {
    AuthenticatorAttachmentEnumFromJSON,
    AuthenticatorAttachmentEnumToJSON,
} from "./AuthenticatorAttachmentEnum";
import type { UserVerificationEnum } from "./UserVerificationEnum";
import { UserVerificationEnumFromJSON, UserVerificationEnumToJSON } from "./UserVerificationEnum";
import type { WebAuthnHintEnum } from "./WebAuthnHintEnum";
import { WebAuthnHintEnumFromJSON, WebAuthnHintEnumToJSON } from "./WebAuthnHintEnum";

/**
 * AuthenticatorWebAuthnStage Serializer
 * @export
 * @interface PatchedAuthenticatorWebAuthnStageRequest
 */
export interface PatchedAuthenticatorWebAuthnStageRequest {
    /**
     *
     * @type {string}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    name?: string;
    /**
     * Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.
     * @type {string}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    configureFlow?: string | null;
    /**
     *
     * @type {string}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    friendlyName?: string;
    /**
     *
     * @type {UserVerificationEnum}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    userVerification?: UserVerificationEnum;
    /**
     *
     * @type {AuthenticatorAttachmentEnum}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    authenticatorAttachment?: AuthenticatorAttachmentEnum | null;
    /**
     *
     * @type {UserVerificationEnum}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    residentKeyRequirement?: UserVerificationEnum;
    /**
     *
     * @type {Array<WebAuthnHintEnum>}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    hints?: Array<WebAuthnHintEnum>;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    deviceTypeRestrictions?: Array<string>;
    /**
     * When enabled, a given device can only be registered once.
     * @type {boolean}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    preventDuplicateDevices?: boolean;
    /**
     *
     * @type {number}
     * @memberof PatchedAuthenticatorWebAuthnStageRequest
     */
    maxAttempts?: number;
}

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

export function PatchedAuthenticatorWebAuthnStageRequestFromJSON(
    json: any,
): PatchedAuthenticatorWebAuthnStageRequest {
    return PatchedAuthenticatorWebAuthnStageRequestFromJSONTyped(json, false);
}

export function PatchedAuthenticatorWebAuthnStageRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedAuthenticatorWebAuthnStageRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : json["name"],
        configureFlow: json["configure_flow"] == null ? undefined : json["configure_flow"],
        friendlyName: json["friendly_name"] == null ? undefined : json["friendly_name"],
        userVerification:
            json["user_verification"] == null
                ? undefined
                : UserVerificationEnumFromJSON(json["user_verification"]),
        authenticatorAttachment:
            json["authenticator_attachment"] == null
                ? undefined
                : AuthenticatorAttachmentEnumFromJSON(json["authenticator_attachment"]),
        residentKeyRequirement:
            json["resident_key_requirement"] == null
                ? undefined
                : UserVerificationEnumFromJSON(json["resident_key_requirement"]),
        hints:
            json["hints"] == null
                ? undefined
                : (json["hints"] as Array<any>).map(WebAuthnHintEnumFromJSON),
        deviceTypeRestrictions:
            json["device_type_restrictions"] == null ? undefined : json["device_type_restrictions"],
        preventDuplicateDevices:
            json["prevent_duplicate_devices"] == null
                ? undefined
                : json["prevent_duplicate_devices"],
        maxAttempts: json["max_attempts"] == null ? undefined : json["max_attempts"],
    };
}

export function PatchedAuthenticatorWebAuthnStageRequestToJSON(
    json: any,
): PatchedAuthenticatorWebAuthnStageRequest {
    return PatchedAuthenticatorWebAuthnStageRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        configure_flow: value["configureFlow"],
        friendly_name: value["friendlyName"],
        user_verification: UserVerificationEnumToJSON(value["userVerification"]),
        authenticator_attachment: AuthenticatorAttachmentEnumToJSON(
            value["authenticatorAttachment"],
        ),
        resident_key_requirement: UserVerificationEnumToJSON(value["residentKeyRequirement"]),
        hints:
            value["hints"] == null
                ? undefined
                : (value["hints"] as Array<any>).map(WebAuthnHintEnumToJSON),
        device_type_restrictions: value["deviceTypeRestrictions"],
        prevent_duplicate_devices: value["preventDuplicateDevices"],
        max_attempts: value["maxAttempts"],
    };
}
