/* 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 { DeviceClassesEnum } from "./DeviceClassesEnum";
import { DeviceClassesEnumFromJSON, DeviceClassesEnumToJSON } from "./DeviceClassesEnum";
import type { FlowSet } from "./FlowSet";
import { FlowSetFromJSON } from "./FlowSet";
import type { NotConfiguredActionEnum } from "./NotConfiguredActionEnum";
import {
    NotConfiguredActionEnumFromJSON,
    NotConfiguredActionEnumToJSON,
} from "./NotConfiguredActionEnum";
import type { UserVerificationEnum } from "./UserVerificationEnum";
import { UserVerificationEnumFromJSON, UserVerificationEnumToJSON } from "./UserVerificationEnum";
import type { WebAuthnDeviceType } from "./WebAuthnDeviceType";
import { WebAuthnDeviceTypeFromJSON } from "./WebAuthnDeviceType";
import type { WebAuthnHintEnum } from "./WebAuthnHintEnum";
import { WebAuthnHintEnumFromJSON, WebAuthnHintEnumToJSON } from "./WebAuthnHintEnum";

/**
 * AuthenticatorValidateStage Serializer
 * @export
 * @interface AuthenticatorValidateStage
 */
export interface AuthenticatorValidateStage {
    /**
     *
     * @type {string}
     * @memberof AuthenticatorValidateStage
     */
    readonly pk: string;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorValidateStage
     */
    name: string;
    /**
     * Get object type so that we know how to edit the object
     * @type {string}
     * @memberof AuthenticatorValidateStage
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof AuthenticatorValidateStage
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof AuthenticatorValidateStage
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof AuthenticatorValidateStage
     */
    readonly metaModelName: string;
    /**
     *
     * @type {Array<FlowSet>}
     * @memberof AuthenticatorValidateStage
     */
    readonly flowSet: Array<FlowSet>;
    /**
     *
     * @type {NotConfiguredActionEnum}
     * @memberof AuthenticatorValidateStage
     */
    notConfiguredAction?: NotConfiguredActionEnum;
    /**
     * Device classes which can be used to authenticate
     * @type {Array<DeviceClassesEnum>}
     * @memberof AuthenticatorValidateStage
     */
    deviceClasses?: Array<DeviceClassesEnum>;
    /**
     * Stages used to configure Authenticator when user doesn't have any compatible devices. After this configuration Stage passes, the user is not prompted again.
     * @type {Array<string>}
     * @memberof AuthenticatorValidateStage
     */
    configurationStages?: Array<string>;
    /**
     * If any of the user's device has been used within this threshold, this stage will be skipped
     * @type {string}
     * @memberof AuthenticatorValidateStage
     */
    lastAuthThreshold?: string;
    /**
     * Enforce user verification for WebAuthn devices.
     * @type {UserVerificationEnum}
     * @memberof AuthenticatorValidateStage
     */
    webauthnUserVerification?: UserVerificationEnum;
    /**
     *
     * @type {Array<WebAuthnHintEnum>}
     * @memberof AuthenticatorValidateStage
     */
    webauthnHints?: Array<WebAuthnHintEnum>;
    /**
     *
     * @type {Array<string>}
     * @memberof AuthenticatorValidateStage
     */
    webauthnAllowedDeviceTypes?: Array<string>;
    /**
     *
     * @type {Array<WebAuthnDeviceType>}
     * @memberof AuthenticatorValidateStage
     */
    readonly webauthnAllowedDeviceTypesObj: Array<WebAuthnDeviceType>;
}

/**
 * Check if a given object implements the AuthenticatorValidateStage interface.
 */
export function instanceOfAuthenticatorValidateStage(
    value: object,
): value is AuthenticatorValidateStage {
    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 (
        !("webauthnAllowedDeviceTypesObj" in value) ||
        value["webauthnAllowedDeviceTypesObj"] === undefined
    )
        return false;
    return true;
}

export function AuthenticatorValidateStageFromJSON(json: any): AuthenticatorValidateStage {
    return AuthenticatorValidateStageFromJSONTyped(json, false);
}

export function AuthenticatorValidateStageFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): AuthenticatorValidateStage {
    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),
        notConfiguredAction:
            json["not_configured_action"] == null
                ? undefined
                : NotConfiguredActionEnumFromJSON(json["not_configured_action"]),
        deviceClasses:
            json["device_classes"] == null
                ? undefined
                : (json["device_classes"] as Array<any>).map(DeviceClassesEnumFromJSON),
        configurationStages:
            json["configuration_stages"] == null ? undefined : json["configuration_stages"],
        lastAuthThreshold:
            json["last_auth_threshold"] == null ? undefined : json["last_auth_threshold"],
        webauthnUserVerification:
            json["webauthn_user_verification"] == null
                ? undefined
                : UserVerificationEnumFromJSON(json["webauthn_user_verification"]),
        webauthnHints:
            json["webauthn_hints"] == null
                ? undefined
                : (json["webauthn_hints"] as Array<any>).map(WebAuthnHintEnumFromJSON),
        webauthnAllowedDeviceTypes:
            json["webauthn_allowed_device_types"] == null
                ? undefined
                : json["webauthn_allowed_device_types"],
        webauthnAllowedDeviceTypesObj: (
            json["webauthn_allowed_device_types_obj"] as Array<any>
        ).map(WebAuthnDeviceTypeFromJSON),
    };
}

export function AuthenticatorValidateStageToJSON(json: any): AuthenticatorValidateStage {
    return AuthenticatorValidateStageToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        not_configured_action: NotConfiguredActionEnumToJSON(value["notConfiguredAction"]),
        device_classes:
            value["deviceClasses"] == null
                ? undefined
                : (value["deviceClasses"] as Array<any>).map(DeviceClassesEnumToJSON),
        configuration_stages: value["configurationStages"],
        last_auth_threshold: value["lastAuthThreshold"],
        webauthn_user_verification: UserVerificationEnumToJSON(value["webauthnUserVerification"]),
        webauthn_hints:
            value["webauthnHints"] == null
                ? undefined
                : (value["webauthnHints"] as Array<any>).map(WebAuthnHintEnumToJSON),
        webauthn_allowed_device_types: value["webauthnAllowedDeviceTypes"],
    };
}
