/* 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 { BackendsEnum } from './BackendsEnum';
import {
    BackendsEnumFromJSON,
    BackendsEnumFromJSONTyped,
    BackendsEnumToJSON,
    BackendsEnumToJSONTyped,
} from './BackendsEnum';
import type { FlowSet } from './FlowSet';
import {
    FlowSetFromJSON,
    FlowSetFromJSONTyped,
    FlowSetToJSON,
    FlowSetToJSONTyped,
} from './FlowSet';

/**
 * PasswordStage Serializer
 * @export
 * @interface PasswordStage
 */
export interface PasswordStage {
    /**
     * 
     * @type {string}
     * @memberof PasswordStage
     */
    readonly pk: string;
    /**
     * 
     * @type {string}
     * @memberof PasswordStage
     */
    name: string;
    /**
     * Get object type so that we know how to edit the object
     * @type {string}
     * @memberof PasswordStage
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof PasswordStage
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof PasswordStage
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof PasswordStage
     */
    readonly metaModelName: string;
    /**
     * 
     * @type {Array<FlowSet>}
     * @memberof PasswordStage
     */
    flowSet?: Array<FlowSet>;
    /**
     * Selection of backends to test the password against.
     * @type {Array<BackendsEnum>}
     * @memberof PasswordStage
     */
    backends: Array<BackendsEnum>;
    /**
     * Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.
     * @type {string}
     * @memberof PasswordStage
     */
    configureFlow?: string | null;
    /**
     * How many attempts a user has before the flow is canceled. To lock the user out, use a reputation policy and a user_write stage.
     * @type {number}
     * @memberof PasswordStage
     */
    failedAttemptsBeforeCancel?: number;
    /**
     * When enabled, provides a 'show password' button with the password input field.
     * @type {boolean}
     * @memberof PasswordStage
     */
    allowShowPassword?: boolean;
}

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

export function PasswordStageFromJSON(json: any): PasswordStage {
    return PasswordStageFromJSONTyped(json, false);
}

export function PasswordStageFromJSONTyped(json: any, ignoreDiscriminator: boolean): PasswordStage {
    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'] == null ? undefined : ((json['flow_set'] as Array<any>).map(FlowSetFromJSON)),
        'backends': ((json['backends'] as Array<any>).map(BackendsEnumFromJSON)),
        'configureFlow': json['configure_flow'] == null ? undefined : json['configure_flow'],
        'failedAttemptsBeforeCancel': json['failed_attempts_before_cancel'] == null ? undefined : json['failed_attempts_before_cancel'],
        'allowShowPassword': json['allow_show_password'] == null ? undefined : json['allow_show_password'],
    };
}

export function PasswordStageToJSON(json: any): PasswordStage {
    return PasswordStageToJSONTyped(json, false);
}

export function PasswordStageToJSONTyped(value?: Omit<PasswordStage, 'pk'|'component'|'verbose_name'|'verbose_name_plural'|'meta_model_name'> | 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(FlowSetToJSON)),
        'backends': ((value['backends'] as Array<any>).map(BackendsEnumToJSON)),
        'configure_flow': value['configureFlow'],
        'failed_attempts_before_cancel': value['failedAttemptsBeforeCancel'],
        'allow_show_password': value['allowShowPassword'],
    };
}

