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

/**
 * UserWriteStage Serializer
 * @export
 * @interface PatchedUserWriteStageRequest
 */
export interface PatchedUserWriteStageRequest {
    /**
     *
     * @type {string}
     * @memberof PatchedUserWriteStageRequest
     */
    name?: string;
    /**
     *
     * @type {UserCreationModeEnum}
     * @memberof PatchedUserWriteStageRequest
     */
    userCreationMode?: UserCreationModeEnum;
    /**
     * When set, newly created users are inactive and cannot login.
     * @type {boolean}
     * @memberof PatchedUserWriteStageRequest
     */
    createUsersAsInactive?: boolean;
    /**
     * Optionally add newly created users to this group.
     * @type {string}
     * @memberof PatchedUserWriteStageRequest
     */
    createUsersGroup?: string | null;
    /**
     *
     * @type {UserTypeEnum}
     * @memberof PatchedUserWriteStageRequest
     */
    userType?: UserTypeEnum;
    /**
     *
     * @type {string}
     * @memberof PatchedUserWriteStageRequest
     */
    userPathTemplate?: string;
}

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

export function PatchedUserWriteStageRequestFromJSON(json: any): PatchedUserWriteStageRequest {
    return PatchedUserWriteStageRequestFromJSONTyped(json, false);
}

export function PatchedUserWriteStageRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedUserWriteStageRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : json["name"],
        userCreationMode:
            json["user_creation_mode"] == null
                ? undefined
                : UserCreationModeEnumFromJSON(json["user_creation_mode"]),
        createUsersAsInactive:
            json["create_users_as_inactive"] == null ? undefined : json["create_users_as_inactive"],
        createUsersGroup:
            json["create_users_group"] == null ? undefined : json["create_users_group"],
        userType: json["user_type"] == null ? undefined : UserTypeEnumFromJSON(json["user_type"]),
        userPathTemplate:
            json["user_path_template"] == null ? undefined : json["user_path_template"],
    };
}

export function PatchedUserWriteStageRequestToJSON(json: any): PatchedUserWriteStageRequest {
    return PatchedUserWriteStageRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        user_creation_mode: UserCreationModeEnumToJSON(value["userCreationMode"]),
        create_users_as_inactive: value["createUsersAsInactive"],
        create_users_group: value["createUsersGroup"],
        user_type: UserTypeEnumToJSON(value["userType"]),
        user_path_template: value["userPathTemplate"],
    };
}
