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

/**
 * Check if a given object implements the PatchedUserLoginStageRequest interface.
 */
export function instanceOfPatchedUserLoginStageRequest(
    value: object,
): value is PatchedUserLoginStageRequest {
    return true;
}

export function PatchedUserLoginStageRequestFromJSON(json: any): PatchedUserLoginStageRequest {
    return PatchedUserLoginStageRequestFromJSONTyped(json, false);
}

export function PatchedUserLoginStageRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedUserLoginStageRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : 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 PatchedUserLoginStageRequestToJSON(json: any): PatchedUserLoginStageRequest {
    return PatchedUserLoginStageRequestToJSONTyped(json, false);
}

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