/* 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 { UserSelf } from "./UserSelf";
import { UserSelfFromJSON, UserSelfToJSON } from "./UserSelf";

/**
 * Response for the /user/me endpoint, returns the currently active user (as `user` property)
 * and, if this user is being impersonated, the original user in the `original` property.
 * @export
 * @interface SessionUser
 */
export interface SessionUser {
    /**
     *
     * @type {UserSelf}
     * @memberof SessionUser
     */
    user: UserSelf;
    /**
     *
     * @type {UserSelf}
     * @memberof SessionUser
     */
    original?: UserSelf;
}

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

export function SessionUserFromJSON(json: any): SessionUser {
    return SessionUserFromJSONTyped(json, false);
}

export function SessionUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): SessionUser {
    if (json == null) {
        return json;
    }
    return {
        user: UserSelfFromJSON(json["user"]),
        original: json["original"] == null ? undefined : UserSelfFromJSON(json["original"]),
    };
}

export function SessionUserToJSON(json: any): SessionUser {
    return SessionUserToJSONTyped(json, false);
}

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

    return {
        user: UserSelfToJSON(value["user"]),
        original: UserSelfToJSON(value["original"]),
    };
}
