/* 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 { Permission } from "./Permission";
import { PermissionFromJSON } from "./Permission";

/**
 * InitialPermissions serializer
 * @export
 * @interface InitialPermissions
 */
export interface InitialPermissions {
    /**
     *
     * @type {number}
     * @memberof InitialPermissions
     */
    readonly pk: number;
    /**
     *
     * @type {string}
     * @memberof InitialPermissions
     */
    name: string;
    /**
     *
     * @type {string}
     * @memberof InitialPermissions
     */
    role: string;
    /**
     *
     * @type {Array<number>}
     * @memberof InitialPermissions
     */
    permissions?: Array<number>;
    /**
     *
     * @type {Array<Permission>}
     * @memberof InitialPermissions
     */
    readonly permissionsObj: Array<Permission>;
}

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

export function InitialPermissionsFromJSON(json: any): InitialPermissions {
    return InitialPermissionsFromJSONTyped(json, false);
}

export function InitialPermissionsFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): InitialPermissions {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        role: json["role"],
        permissions: json["permissions"] == null ? undefined : json["permissions"],
        permissionsObj: (json["permissions_obj"] as Array<any>).map(PermissionFromJSON),
    };
}

export function InitialPermissionsToJSON(json: any): InitialPermissions {
    return InitialPermissionsToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        role: value["role"],
        permissions: value["permissions"],
    };
}
