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

import type { FlowSet } from "./FlowSet";
import { FlowSetFromJSON } from "./FlowSet";

/**
 * AuthenticatorEmailStage Serializer
 * @export
 * @interface AuthenticatorEmailStage
 */
export interface AuthenticatorEmailStage {
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    readonly pk: string;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    name: string;
    /**
     * Get object type so that we know how to edit the object
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    readonly metaModelName: string;
    /**
     *
     * @type {Array<FlowSet>}
     * @memberof AuthenticatorEmailStage
     */
    readonly flowSet: Array<FlowSet>;
    /**
     * Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    configureFlow?: string | null;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    friendlyName?: string;
    /**
     * When enabled, global Email connection settings will be used and connection settings below will be ignored.
     * @type {boolean}
     * @memberof AuthenticatorEmailStage
     */
    useGlobalSettings?: boolean;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    host?: string;
    /**
     *
     * @type {number}
     * @memberof AuthenticatorEmailStage
     */
    port?: number;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    username?: string;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    password?: string;
    /**
     *
     * @type {boolean}
     * @memberof AuthenticatorEmailStage
     */
    useTls?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof AuthenticatorEmailStage
     */
    useSsl?: boolean;
    /**
     *
     * @type {number}
     * @memberof AuthenticatorEmailStage
     */
    timeout?: number;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    fromAddress?: string;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    subject?: string;
    /**
     * Time the token sent is valid (Format: hours=3,minutes=17,seconds=300).
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    tokenExpiry?: string;
    /**
     *
     * @type {string}
     * @memberof AuthenticatorEmailStage
     */
    template?: string;
}

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

export function AuthenticatorEmailStageFromJSON(json: any): AuthenticatorEmailStage {
    return AuthenticatorEmailStageFromJSONTyped(json, false);
}

export function AuthenticatorEmailStageFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): AuthenticatorEmailStage {
    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"] as Array<any>).map(FlowSetFromJSON),
        configureFlow: json["configure_flow"] == null ? undefined : json["configure_flow"],
        friendlyName: json["friendly_name"] == null ? undefined : json["friendly_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"],
        subject: json["subject"] == null ? undefined : json["subject"],
        tokenExpiry: json["token_expiry"] == null ? undefined : json["token_expiry"],
        template: json["template"] == null ? undefined : json["template"],
    };
}

export function AuthenticatorEmailStageToJSON(json: any): AuthenticatorEmailStage {
    return AuthenticatorEmailStageToJSONTyped(json, false);
}

export function AuthenticatorEmailStageToJSONTyped(
    value?: Omit<
        AuthenticatorEmailStage,
        "pk" | "component" | "verbose_name" | "verbose_name_plural" | "meta_model_name" | "flow_set"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        configure_flow: value["configureFlow"],
        friendly_name: value["friendlyName"],
        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"],
        subject: value["subject"],
        token_expiry: value["tokenExpiry"],
        template: value["template"],
    };
}
