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

/**
 * UserWriteStage Serializer
 * @export
 * @interface UserWriteStage
 */
export interface UserWriteStage {
    /**
     *
     * @type {string}
     * @memberof UserWriteStage
     */
    readonly pk: string;
    /**
     *
     * @type {string}
     * @memberof UserWriteStage
     */
    name: string;
    /**
     * Get object type so that we know how to edit the object
     * @type {string}
     * @memberof UserWriteStage
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof UserWriteStage
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof UserWriteStage
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof UserWriteStage
     */
    readonly metaModelName: string;
    /**
     *
     * @type {Array<FlowSet>}
     * @memberof UserWriteStage
     */
    readonly flowSet: Array<FlowSet>;
    /**
     *
     * @type {UserCreationModeEnum}
     * @memberof UserWriteStage
     */
    userCreationMode?: UserCreationModeEnum;
    /**
     * When set, newly created users are inactive and cannot login.
     * @type {boolean}
     * @memberof UserWriteStage
     */
    createUsersAsInactive?: boolean;
    /**
     * Optionally add newly created users to this group.
     * @type {string}
     * @memberof UserWriteStage
     */
    createUsersGroup?: string | null;
    /**
     *
     * @type {UserTypeEnum}
     * @memberof UserWriteStage
     */
    userType?: UserTypeEnum;
    /**
     *
     * @type {string}
     * @memberof UserWriteStage
     */
    userPathTemplate?: string;
}

/**
 * Check if a given object implements the UserWriteStage interface.
 */
export function instanceOfUserWriteStage(value: object): value is UserWriteStage {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("component" in value) || value["component"] === undefined) return false;
    if (!("verboseName" in value) || value["verboseName"] === undefined) return false;
    if (!("verboseNamePlural" in value) || value["verboseNamePlural"] === undefined) return false;
    if (!("metaModelName" in value) || value["metaModelName"] === undefined) return false;
    if (!("flowSet" in value) || value["flowSet"] === undefined) return false;
    return true;
}

export function UserWriteStageFromJSON(json: any): UserWriteStage {
    return UserWriteStageFromJSONTyped(json, false);
}

export function UserWriteStageFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): UserWriteStage {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        component: json["component"],
        verboseName: json["verbose_name"],
        verboseNamePlural: json["verbose_name_plural"],
        metaModelName: json["meta_model_name"],
        flowSet: (json["flow_set"] as Array<any>).map(FlowSetFromJSON),
        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 UserWriteStageToJSON(json: any): UserWriteStage {
    return UserWriteStageToJSONTyped(json, false);
}

export function UserWriteStageToJSONTyped(
    value?: Omit<
        UserWriteStage,
        "pk" | "component" | "verbose_name" | "verbose_name_plural" | "meta_model_name" | "flow_set"
    > | 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"],
    };
}
