/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.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 { FlowSetRequest } from './FlowSetRequest';
import {
    FlowSetRequestFromJSON,
    FlowSetRequestFromJSONTyped,
    FlowSetRequestToJSON,
    FlowSetRequestToJSONTyped,
} from './FlowSetRequest';

/**
 * PasswordStage Serializer
 * @export
 * @interface PasswordStageRequest
 */
export interface PasswordStageRequest {
    /**
     * 
     * @type {string}
     * @memberof PasswordStageRequest
     */
    name: string;
    /**
     * 
     * @type {Array<FlowSetRequest>}
     * @memberof PasswordStageRequest
     */
    flowSet?: Array<FlowSetRequest>;
    /**
     * Selection of backends to test the password against.
     * @type {Array<BackendsEnum>}
     * @memberof PasswordStageRequest
     */
    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 PasswordStageRequest
     */
    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 PasswordStageRequest
     */
    failedAttemptsBeforeCancel?: number;
    /**
     * When enabled, provides a 'show password' button with the password input field.
     * @type {boolean}
     * @memberof PasswordStageRequest
     */
    allowShowPassword?: boolean;
}

/**
 * Check if a given object implements the PasswordStageRequest interface.
 */
export function instanceOfPasswordStageRequest(value: object): value is PasswordStageRequest {
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('backends' in value) || value['backends'] === undefined) return false;
    return true;
}

export function PasswordStageRequestFromJSON(json: any): PasswordStageRequest {
    return PasswordStageRequestFromJSONTyped(json, false);
}

export function PasswordStageRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PasswordStageRequest {
    if (json == null) {
        return json;
    }
    return {
        
        'name': json['name'],
        'flowSet': json['flow_set'] == null ? undefined : ((json['flow_set'] as Array<any>).map(FlowSetRequestFromJSON)),
        '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 PasswordStageRequestToJSON(json: any): PasswordStageRequest {
    return PasswordStageRequestToJSONTyped(json, false);
}

export function PasswordStageRequestToJSONTyped(value?: PasswordStageRequest | 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(FlowSetRequestToJSON)),
        'backends': ((value['backends'] as Array<any>).map(BackendsEnumToJSON)),
        'configure_flow': value['configureFlow'],
        'failed_attempts_before_cancel': value['failedAttemptsBeforeCancel'],
        'allow_show_password': value['allowShowPassword'],
    };
}

