/* 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';
/**
 * Password Policy Serializer
 * @export
 * @interface PasswordPolicy
 */
export interface PasswordPolicy {
    /**
     * 
     * @type {string}
     * @memberof PasswordPolicy
     */
    readonly pk: string;
    /**
     * 
     * @type {string}
     * @memberof PasswordPolicy
     */
    name: string;
    /**
     * When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.
     * @type {boolean}
     * @memberof PasswordPolicy
     */
    executionLogging?: boolean;
    /**
     * Get object component so that we know how to edit the object
     * @type {string}
     * @memberof PasswordPolicy
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof PasswordPolicy
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof PasswordPolicy
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof PasswordPolicy
     */
    readonly metaModelName: string;
    /**
     * Return objects policy is bound to
     * @type {number}
     * @memberof PasswordPolicy
     */
    readonly boundTo: number;
    /**
     * Field key to check, field keys defined in Prompt stages are available.
     * @type {string}
     * @memberof PasswordPolicy
     */
    passwordField?: string;
    /**
     * 
     * @type {number}
     * @memberof PasswordPolicy
     */
    amountDigits?: number;
    /**
     * 
     * @type {number}
     * @memberof PasswordPolicy
     */
    amountUppercase?: number;
    /**
     * 
     * @type {number}
     * @memberof PasswordPolicy
     */
    amountLowercase?: number;
    /**
     * 
     * @type {number}
     * @memberof PasswordPolicy
     */
    amountSymbols?: number;
    /**
     * 
     * @type {number}
     * @memberof PasswordPolicy
     */
    lengthMin?: number;
    /**
     * 
     * @type {string}
     * @memberof PasswordPolicy
     */
    symbolCharset?: string;
    /**
     * 
     * @type {string}
     * @memberof PasswordPolicy
     */
    errorMessage?: string;
    /**
     * 
     * @type {boolean}
     * @memberof PasswordPolicy
     */
    checkStaticRules?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof PasswordPolicy
     */
    checkHaveIBeenPwned?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof PasswordPolicy
     */
    checkZxcvbn?: boolean;
    /**
     * How many times the password hash is allowed to be on haveibeenpwned
     * @type {number}
     * @memberof PasswordPolicy
     */
    hibpAllowedCount?: number;
    /**
     * If the zxcvbn score is equal or less than this value, the policy will fail.
     * @type {number}
     * @memberof PasswordPolicy
     */
    zxcvbnScoreThreshold?: number;
}

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

export function PasswordPolicyFromJSON(json: any): PasswordPolicy {
    return PasswordPolicyFromJSONTyped(json, false);
}

export function PasswordPolicyFromJSONTyped(json: any, ignoreDiscriminator: boolean): PasswordPolicy {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'name': json['name'],
        'executionLogging': json['execution_logging'] == null ? undefined : json['execution_logging'],
        'component': json['component'],
        'verboseName': json['verbose_name'],
        'verboseNamePlural': json['verbose_name_plural'],
        'metaModelName': json['meta_model_name'],
        'boundTo': json['bound_to'],
        'passwordField': json['password_field'] == null ? undefined : json['password_field'],
        'amountDigits': json['amount_digits'] == null ? undefined : json['amount_digits'],
        'amountUppercase': json['amount_uppercase'] == null ? undefined : json['amount_uppercase'],
        'amountLowercase': json['amount_lowercase'] == null ? undefined : json['amount_lowercase'],
        'amountSymbols': json['amount_symbols'] == null ? undefined : json['amount_symbols'],
        'lengthMin': json['length_min'] == null ? undefined : json['length_min'],
        'symbolCharset': json['symbol_charset'] == null ? undefined : json['symbol_charset'],
        'errorMessage': json['error_message'] == null ? undefined : json['error_message'],
        'checkStaticRules': json['check_static_rules'] == null ? undefined : json['check_static_rules'],
        'checkHaveIBeenPwned': json['check_have_i_been_pwned'] == null ? undefined : json['check_have_i_been_pwned'],
        'checkZxcvbn': json['check_zxcvbn'] == null ? undefined : json['check_zxcvbn'],
        'hibpAllowedCount': json['hibp_allowed_count'] == null ? undefined : json['hibp_allowed_count'],
        'zxcvbnScoreThreshold': json['zxcvbn_score_threshold'] == null ? undefined : json['zxcvbn_score_threshold'],
    };
}

export function PasswordPolicyToJSON(json: any): PasswordPolicy {
    return PasswordPolicyToJSONTyped(json, false);
}

export function PasswordPolicyToJSONTyped(value?: Omit<PasswordPolicy, 'pk'|'component'|'verbose_name'|'verbose_name_plural'|'meta_model_name'|'bound_to'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'execution_logging': value['executionLogging'],
        'password_field': value['passwordField'],
        'amount_digits': value['amountDigits'],
        'amount_uppercase': value['amountUppercase'],
        'amount_lowercase': value['amountLowercase'],
        'amount_symbols': value['amountSymbols'],
        'length_min': value['lengthMin'],
        'symbol_charset': value['symbolCharset'],
        'error_message': value['errorMessage'],
        'check_static_rules': value['checkStaticRules'],
        'check_have_i_been_pwned': value['checkHaveIBeenPwned'],
        'check_zxcvbn': value['checkZxcvbn'],
        'hibp_allowed_count': value['hibpAllowedCount'],
        'zxcvbn_score_threshold': value['zxcvbnScoreThreshold'],
    };
}

