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

/**
 * Payload to create a service account
 * @export
 * @interface UserServiceAccountRequest
 */
export interface UserServiceAccountRequest {
    /**
     *
     * @type {string}
     * @memberof UserServiceAccountRequest
     */
    name: string;
    /**
     *
     * @type {boolean}
     * @memberof UserServiceAccountRequest
     */
    createGroup?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof UserServiceAccountRequest
     */
    expiring?: boolean;
    /**
     * If not provided, valid for 360 days
     * @type {Date}
     * @memberof UserServiceAccountRequest
     */
    expires?: Date;
}

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

export function UserServiceAccountRequestFromJSON(json: any): UserServiceAccountRequest {
    return UserServiceAccountRequestFromJSONTyped(json, false);
}

export function UserServiceAccountRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): UserServiceAccountRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        createGroup: json["create_group"] == null ? undefined : json["create_group"],
        expiring: json["expiring"] == null ? undefined : json["expiring"],
        expires: json["expires"] == null ? undefined : new Date(json["expires"]),
    };
}

export function UserServiceAccountRequestToJSON(json: any): UserServiceAccountRequest {
    return UserServiceAccountRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        create_group: value["createGroup"],
        expiring: value["expiring"],
        expires: value["expires"] == null ? value["expires"] : value["expires"].toISOString(),
    };
}
