/* 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 { UserTypeEnum } from "./UserTypeEnum";
import { UserTypeEnumFromJSON, UserTypeEnumToJSON } from "./UserTypeEnum";

/**
 * User Serializer
 * @export
 * @interface PatchedUserRequest
 */
export interface PatchedUserRequest {
    /**
     *
     * @type {string}
     * @memberof PatchedUserRequest
     */
    username?: string;
    /**
     * User's display name.
     * @type {string}
     * @memberof PatchedUserRequest
     */
    name?: string;
    /**
     * Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
     * @type {boolean}
     * @memberof PatchedUserRequest
     */
    isActive?: boolean;
    /**
     *
     * @type {Date}
     * @memberof PatchedUserRequest
     */
    lastLogin?: Date | null;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedUserRequest
     */
    groups?: Array<string>;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedUserRequest
     */
    roles?: Array<string>;
    /**
     *
     * @type {string}
     * @memberof PatchedUserRequest
     */
    email?: string;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof PatchedUserRequest
     */
    attributes?: { [key: string]: any };
    /**
     *
     * @type {string}
     * @memberof PatchedUserRequest
     */
    path?: string;
    /**
     *
     * @type {UserTypeEnum}
     * @memberof PatchedUserRequest
     */
    type?: UserTypeEnum;
}

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

export function PatchedUserRequestFromJSON(json: any): PatchedUserRequest {
    return PatchedUserRequestFromJSONTyped(json, false);
}

export function PatchedUserRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedUserRequest {
    if (json == null) {
        return json;
    }
    return {
        username: json["username"] == null ? undefined : json["username"],
        name: json["name"] == null ? undefined : json["name"],
        isActive: json["is_active"] == null ? undefined : json["is_active"],
        lastLogin: json["last_login"] == null ? undefined : new Date(json["last_login"]),
        groups: json["groups"] == null ? undefined : json["groups"],
        roles: json["roles"] == null ? undefined : json["roles"],
        email: json["email"] == null ? undefined : json["email"],
        attributes: json["attributes"] == null ? undefined : json["attributes"],
        path: json["path"] == null ? undefined : json["path"],
        type: json["type"] == null ? undefined : UserTypeEnumFromJSON(json["type"]),
    };
}

export function PatchedUserRequestToJSON(json: any): PatchedUserRequest {
    return PatchedUserRequestToJSONTyped(json, false);
}

export function PatchedUserRequestToJSONTyped(
    value?: PatchedUserRequest | 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(),
        groups: value["groups"],
        roles: value["roles"],
        email: value["email"],
        attributes: value["attributes"],
        path: value["path"],
        type: UserTypeEnumToJSON(value["type"]),
    };
}
