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

/**
 * Global permission
 * @export
 * @interface Permission
 */
export interface Permission {
    /**
     *
     * @type {number}
     * @memberof Permission
     */
    readonly id: number;
    /**
     *
     * @type {string}
     * @memberof Permission
     */
    name: string;
    /**
     *
     * @type {string}
     * @memberof Permission
     */
    codename: string;
    /**
     *
     * @type {string}
     * @memberof Permission
     */
    readonly model: string;
    /**
     *
     * @type {string}
     * @memberof Permission
     */
    readonly appLabel: string;
    /**
     * Human-readable app label
     * @type {string}
     * @memberof Permission
     */
    readonly appLabelVerbose: string;
    /**
     * Human-readable model name
     * @type {string}
     * @memberof Permission
     */
    readonly modelVerbose: string;
}

/**
 * Check if a given object implements the Permission interface.
 */
export function instanceOfPermission(value: object): value is Permission {
    if (!("id" in value) || value["id"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("codename" in value) || value["codename"] === undefined) return false;
    if (!("model" in value) || value["model"] === undefined) return false;
    if (!("appLabel" in value) || value["appLabel"] === undefined) return false;
    if (!("appLabelVerbose" in value) || value["appLabelVerbose"] === undefined) return false;
    if (!("modelVerbose" in value) || value["modelVerbose"] === undefined) return false;
    return true;
}

export function PermissionFromJSON(json: any): Permission {
    return PermissionFromJSONTyped(json, false);
}

export function PermissionFromJSONTyped(json: any, ignoreDiscriminator: boolean): Permission {
    if (json == null) {
        return json;
    }
    return {
        id: json["id"],
        name: json["name"],
        codename: json["codename"],
        model: json["model"],
        appLabel: json["app_label"],
        appLabelVerbose: json["app_label_verbose"],
        modelVerbose: json["model_verbose"],
    };
}

export function PermissionToJSON(json: any): Permission {
    return PermissionToJSONTyped(json, false);
}

export function PermissionToJSONTyped(
    value?: Omit<
        Permission,
        "id" | "model" | "app_label" | "app_label_verbose" | "model_verbose"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        codename: value["codename"],
    };
}
