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

/**
 * UserLoginStage Serializer
 * @export
 * @interface UserLoginStageRequest
 */
export interface UserLoginStageRequest {
    /**
     *
     * @type {string}
     * @memberof UserLoginStageRequest
     */
    name: string;
    /**
     * 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 UserLoginStageRequest
     */
    sessionDuration?: string;
    /**
     * Terminate all other sessions of the user logging in.
     * @type {boolean}
     * @memberof UserLoginStageRequest
     */
    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 UserLoginStageRequest
     */
    rememberMeOffset?: string;
    /**
     * Bind sessions created by this stage to the configured network
     * @type {NetworkBindingEnum}
     * @memberof UserLoginStageRequest
     */
    networkBinding?: NetworkBindingEnum;
    /**
     * Bind sessions created by this stage to the configured GeoIP location
     * @type {GeoipBindingEnum}
     * @memberof UserLoginStageRequest
     */
    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 UserLoginStageRequest
     */
    rememberDevice?: string;
}

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

export function UserLoginStageRequestFromJSON(json: any): UserLoginStageRequest {
    return UserLoginStageRequestFromJSONTyped(json, false);
}

export function UserLoginStageRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): UserLoginStageRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        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 UserLoginStageRequestToJSON(json: any): UserLoginStageRequest {
    return UserLoginStageRequestToJSONTyped(json, false);
}

export function UserLoginStageRequestToJSONTyped(
    value?: UserLoginStageRequest | 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"],
    };
}
