/* 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 { FlowSet } from './FlowSet';
import {
    FlowSetFromJSON,
    FlowSetFromJSONTyped,
    FlowSetToJSON,
    FlowSetToJSONTyped,
} from './FlowSet';

/**
 * EmailStage Serializer
 * @export
 * @interface EmailStage
 */
export interface EmailStage {
    /**
     * 
     * @type {string}
     * @memberof EmailStage
     */
    readonly pk: string;
    /**
     * 
     * @type {string}
     * @memberof EmailStage
     */
    name: string;
    /**
     * Get object type so that we know how to edit the object
     * @type {string}
     * @memberof EmailStage
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof EmailStage
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof EmailStage
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof EmailStage
     */
    readonly metaModelName: string;
    /**
     * 
     * @type {Array<FlowSet>}
     * @memberof EmailStage
     */
    flowSet?: Array<FlowSet>;
    /**
     * When enabled, global Email connection settings will be used and connection settings below will be ignored.
     * @type {boolean}
     * @memberof EmailStage
     */
    useGlobalSettings?: boolean;
    /**
     * 
     * @type {string}
     * @memberof EmailStage
     */
    host?: string;
    /**
     * 
     * @type {number}
     * @memberof EmailStage
     */
    port?: number;
    /**
     * 
     * @type {string}
     * @memberof EmailStage
     */
    username?: string;
    /**
     * 
     * @type {boolean}
     * @memberof EmailStage
     */
    useTls?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof EmailStage
     */
    useSsl?: boolean;
    /**
     * 
     * @type {number}
     * @memberof EmailStage
     */
    timeout?: number;
    /**
     * 
     * @type {string}
     * @memberof EmailStage
     */
    fromAddress?: string;
    /**
     * Time the token sent is valid (Format: hours=3,minutes=17,seconds=300).
     * @type {string}
     * @memberof EmailStage
     */
    tokenExpiry?: string;
    /**
     * 
     * @type {string}
     * @memberof EmailStage
     */
    subject?: string;
    /**
     * 
     * @type {string}
     * @memberof EmailStage
     */
    template?: string;
    /**
     * Activate users upon completion of stage.
     * @type {boolean}
     * @memberof EmailStage
     */
    activateUserOnSuccess?: boolean;
    /**
     * 
     * @type {number}
     * @memberof EmailStage
     */
    recoveryMaxAttempts?: number;
    /**
     * The time window used to count recent account recovery attempts. If the number of attempts exceed recovery_max_attempts within this period, further attempts will be rate-limited. (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof EmailStage
     */
    recoveryCacheTimeout?: string;
}

/**
 * Check if a given object implements the EmailStage interface.
 */
export function instanceOfEmailStage(value: object): value is EmailStage {
    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;
    return true;
}

export function EmailStageFromJSON(json: any): EmailStage {
    return EmailStageFromJSONTyped(json, false);
}

export function EmailStageFromJSONTyped(json: any, ignoreDiscriminator: boolean): EmailStage {
    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)),
        'useGlobalSettings': json['use_global_settings'] == null ? undefined : json['use_global_settings'],
        'host': json['host'] == null ? undefined : json['host'],
        'port': json['port'] == null ? undefined : json['port'],
        'username': json['username'] == null ? undefined : json['username'],
        'useTls': json['use_tls'] == null ? undefined : json['use_tls'],
        'useSsl': json['use_ssl'] == null ? undefined : json['use_ssl'],
        'timeout': json['timeout'] == null ? undefined : json['timeout'],
        'fromAddress': json['from_address'] == null ? undefined : json['from_address'],
        'tokenExpiry': json['token_expiry'] == null ? undefined : json['token_expiry'],
        'subject': json['subject'] == null ? undefined : json['subject'],
        'template': json['template'] == null ? undefined : json['template'],
        'activateUserOnSuccess': json['activate_user_on_success'] == null ? undefined : json['activate_user_on_success'],
        'recoveryMaxAttempts': json['recovery_max_attempts'] == null ? undefined : json['recovery_max_attempts'],
        'recoveryCacheTimeout': json['recovery_cache_timeout'] == null ? undefined : json['recovery_cache_timeout'],
    };
}

export function EmailStageToJSON(json: any): EmailStage {
    return EmailStageToJSONTyped(json, false);
}

export function EmailStageToJSONTyped(value?: Omit<EmailStage, '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)),
        'use_global_settings': value['useGlobalSettings'],
        'host': value['host'],
        'port': value['port'],
        'username': value['username'],
        'use_tls': value['useTls'],
        'use_ssl': value['useSsl'],
        'timeout': value['timeout'],
        'from_address': value['fromAddress'],
        'token_expiry': value['tokenExpiry'],
        'subject': value['subject'],
        'template': value['template'],
        'activate_user_on_success': value['activateUserOnSuccess'],
        'recovery_max_attempts': value['recoveryMaxAttempts'],
        'recovery_cache_timeout': value['recoveryCacheTimeout'],
    };
}

