/* 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";
import type { GeoipBindingEnum } from "./GeoipBindingEnum";
import { GeoipBindingEnumFromJSON, GeoipBindingEnumToJSON } from "./GeoipBindingEnum";
import type { NetworkBindingEnum } from "./NetworkBindingEnum";
import { NetworkBindingEnumFromJSON, NetworkBindingEnumToJSON } from "./NetworkBindingEnum";

/**
 * UserLoginStage Serializer
 * @export
 * @interface UserLoginStage
 */
export interface UserLoginStage {
    /**
     *
     * @type {string}
     * @memberof UserLoginStage
     */
    readonly pk: string;
    /**
     *
     * @type {string}
     * @memberof UserLoginStage
     */
    name: string;
    /**
     * Get object type so that we know how to edit the object
     * @type {string}
     * @memberof UserLoginStage
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof UserLoginStage
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof UserLoginStage
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof UserLoginStage
     */
    readonly metaModelName: string;
    /**
     *
     * @type {Array<FlowSet>}
     * @memberof UserLoginStage
     */
    readonly flowSet: Array<FlowSet>;
    /**
     * Determines how long a session lasts. Default of 0 means that the sessions lasts until the browser is closed. (Format: hours=-1;minutes=-2;seconds=-3)
     * @type {string}
     * @memberof UserLoginStage
     */
    sessionDuration?: string;
    /**
     * Terminate all other sessions of the user logging in.
     * @type {boolean}
     * @memberof UserLoginStage
     */
    terminateOtherSessions?: boolean;
    /**
     * Offset the session will be extended by when the user picks the remember me option. Default of 0 means that the remember me option will not be shown. (Format: hours=-1;minutes=-2;seconds=-3)
     * @type {string}
     * @memberof UserLoginStage
     */
    rememberMeOffset?: string;
    /**
     * Bind sessions created by this stage to the configured network
     * @type {NetworkBindingEnum}
     * @memberof UserLoginStage
     */
    networkBinding?: NetworkBindingEnum;
    /**
     * Bind sessions created by this stage to the configured GeoIP location
     * @type {GeoipBindingEnum}
     * @memberof UserLoginStage
     */
    geoipBinding?: GeoipBindingEnum;
    /**
     * When set to a non-zero value, authentik will save a cookie with a longer expiry,to remember the device the user is logging in from. (Format: hours=-1;minutes=-2;seconds=-3)
     * @type {string}
     * @memberof UserLoginStage
     */
    rememberDevice?: string;
}

/**
 * Check if a given object implements the UserLoginStage interface.
 */
export function instanceOfUserLoginStage(value: object): value is UserLoginStage {
    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 UserLoginStageFromJSON(json: any): UserLoginStage {
    return UserLoginStageFromJSONTyped(json, false);
}

export function UserLoginStageFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): UserLoginStage {
    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),
        sessionDuration: json["session_duration"] == null ? undefined : json["session_duration"],
        terminateOtherSessions:
            json["terminate_other_sessions"] == null ? undefined : json["terminate_other_sessions"],
        rememberMeOffset:
            json["remember_me_offset"] == null ? undefined : json["remember_me_offset"],
        networkBinding:
            json["network_binding"] == null
                ? undefined
                : NetworkBindingEnumFromJSON(json["network_binding"]),
        geoipBinding:
            json["geoip_binding"] == null
                ? undefined
                : GeoipBindingEnumFromJSON(json["geoip_binding"]),
        rememberDevice: json["remember_device"] == null ? undefined : json["remember_device"],
    };
}

export function UserLoginStageToJSON(json: any): UserLoginStage {
    return UserLoginStageToJSONTyped(json, false);
}

export function UserLoginStageToJSONTyped(
    value?: Omit<
        UserLoginStage,
        "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"],
        session_duration: value["sessionDuration"],
        terminate_other_sessions: value["terminateOtherSessions"],
        remember_me_offset: value["rememberMeOffset"],
        network_binding: NetworkBindingEnumToJSON(value["networkBinding"]),
        geoip_binding: GeoipBindingEnumToJSON(value["geoipBinding"]),
        remember_device: value["rememberDevice"],
    };
}
