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

/**
 * Partial User Serializer, does not include child relations.
 * @export
 * @interface PartialUser
 */
export interface PartialUser {
    /**
     *
     * @type {number}
     * @memberof PartialUser
     */
    readonly pk: number;
    /**
     * Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
     * @type {string}
     * @memberof PartialUser
     */
    username: string;
    /**
     * User's display name.
     * @type {string}
     * @memberof PartialUser
     */
    name: string;
    /**
     * Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
     * @type {boolean}
     * @memberof PartialUser
     */
    isActive?: boolean;
    /**
     *
     * @type {Date}
     * @memberof PartialUser
     */
    lastLogin?: Date | null;
    /**
     *
     * @type {string}
     * @memberof PartialUser
     */
    email?: string;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof PartialUser
     */
    attributes?: { [key: string]: any };
    /**
     *
     * @type {string}
     * @memberof PartialUser
     */
    readonly uid: string;
}

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

export function PartialUserFromJSON(json: any): PartialUser {
    return PartialUserFromJSONTyped(json, false);
}

export function PartialUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): PartialUser {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        username: json["username"],
        name: json["name"],
        isActive: json["is_active"] == null ? undefined : json["is_active"],
        lastLogin: json["last_login"] == null ? undefined : new Date(json["last_login"]),
        email: json["email"] == null ? undefined : json["email"],
        attributes: json["attributes"] == null ? undefined : json["attributes"],
        uid: json["uid"],
    };
}

export function PartialUserToJSON(json: any): PartialUser {
    return PartialUserToJSONTyped(json, false);
}

export function PartialUserToJSONTyped(
    value?: Omit<PartialUser, "pk" | "uid"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        username: value["username"],
        name: value["name"],
        is_active: value["isActive"],
        last_login:
            value["lastLogin"] == null ? value["lastLogin"] : value["lastLogin"].toISOString(),
        email: value["email"],
        attributes: value["attributes"],
    };
}
