/* 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.
 */

/**
 * EmailStage Serializer
 * @export
 * @interface EmailStageRequest
 */
export interface EmailStageRequest {
    /**
     *
     * @type {string}
     * @memberof EmailStageRequest
     */
    name: string;
    /**
     * When enabled, global Email connection settings will be used and connection settings below will be ignored.
     * @type {boolean}
     * @memberof EmailStageRequest
     */
    useGlobalSettings?: boolean;
    /**
     *
     * @type {string}
     * @memberof EmailStageRequest
     */
    host?: string;
    /**
     *
     * @type {number}
     * @memberof EmailStageRequest
     */
    port?: number;
    /**
     *
     * @type {string}
     * @memberof EmailStageRequest
     */
    username?: string;
    /**
     *
     * @type {string}
     * @memberof EmailStageRequest
     */
    password?: string;
    /**
     *
     * @type {boolean}
     * @memberof EmailStageRequest
     */
    useTls?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof EmailStageRequest
     */
    useSsl?: boolean;
    /**
     *
     * @type {number}
     * @memberof EmailStageRequest
     */
    timeout?: number;
    /**
     *
     * @type {string}
     * @memberof EmailStageRequest
     */
    fromAddress?: string;
    /**
     * Time the token sent is valid (Format: hours=3,minutes=17,seconds=300).
     * @type {string}
     * @memberof EmailStageRequest
     */
    tokenExpiry?: string;
    /**
     *
     * @type {string}
     * @memberof EmailStageRequest
     */
    subject?: string;
    /**
     *
     * @type {string}
     * @memberof EmailStageRequest
     */
    template?: string;
    /**
     * Activate users upon completion of stage.
     * @type {boolean}
     * @memberof EmailStageRequest
     */
    activateUserOnSuccess?: boolean;
    /**
     *
     * @type {number}
     * @memberof EmailStageRequest
     */
    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 EmailStageRequest
     */
    recoveryCacheTimeout?: string;
}

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

export function EmailStageRequestFromJSON(json: any): EmailStageRequest {
    return EmailStageRequestFromJSONTyped(json, false);
}

export function EmailStageRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): EmailStageRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        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"],
        password: json["password"] == null ? undefined : json["password"],
        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 EmailStageRequestToJSON(json: any): EmailStageRequest {
    return EmailStageRequestToJSONTyped(json, false);
}

export function EmailStageRequestToJSONTyped(
    value?: EmailStageRequest | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        use_global_settings: value["useGlobalSettings"],
        host: value["host"],
        port: value["port"],
        username: value["username"],
        password: value["password"],
        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"],
    };
}
