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

/**
 * Role permission with additional object-related data
 * @export
 * @interface ExtraRoleObjectPermission
 */
export interface ExtraRoleObjectPermission {
    /**
     *
     * @type {number}
     * @memberof ExtraRoleObjectPermission
     */
    readonly id: number;
    /**
     *
     * @type {string}
     * @memberof ExtraRoleObjectPermission
     */
    readonly codename: string;
    /**
     *
     * @type {string}
     * @memberof ExtraRoleObjectPermission
     */
    readonly model: string;
    /**
     *
     * @type {string}
     * @memberof ExtraRoleObjectPermission
     */
    readonly appLabel: string;
    /**
     *
     * @type {string}
     * @memberof ExtraRoleObjectPermission
     */
    objectPk: string;
    /**
     *
     * @type {string}
     * @memberof ExtraRoleObjectPermission
     */
    readonly name: string;
    /**
     * Get app label from permission's model
     * @type {string}
     * @memberof ExtraRoleObjectPermission
     */
    readonly appLabelVerbose: string;
    /**
     * Get model label from permission's model
     * @type {string}
     * @memberof ExtraRoleObjectPermission
     */
    readonly modelVerbose: string;
    /**
     * Get model description from attached model. This operation takes at least
     * one additional query, and the description is only shown if the role has the
     * view_ permission on the object
     * @type {string}
     * @memberof ExtraRoleObjectPermission
     */
    readonly objectDescription: string | null;
}

/**
 * Check if a given object implements the ExtraRoleObjectPermission interface.
 */
export function instanceOfExtraRoleObjectPermission(
    value: object,
): value is ExtraRoleObjectPermission {
    if (!("id" in value) || value["id"] === 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 (!("objectPk" in value) || value["objectPk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("appLabelVerbose" in value) || value["appLabelVerbose"] === undefined) return false;
    if (!("modelVerbose" in value) || value["modelVerbose"] === undefined) return false;
    if (!("objectDescription" in value) || value["objectDescription"] === undefined) return false;
    return true;
}

export function ExtraRoleObjectPermissionFromJSON(json: any): ExtraRoleObjectPermission {
    return ExtraRoleObjectPermissionFromJSONTyped(json, false);
}

export function ExtraRoleObjectPermissionFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): ExtraRoleObjectPermission {
    if (json == null) {
        return json;
    }
    return {
        id: json["id"],
        codename: json["codename"],
        model: json["model"],
        appLabel: json["app_label"],
        objectPk: json["object_pk"],
        name: json["name"],
        appLabelVerbose: json["app_label_verbose"],
        modelVerbose: json["model_verbose"],
        objectDescription: json["object_description"],
    };
}

export function ExtraRoleObjectPermissionToJSON(json: any): ExtraRoleObjectPermission {
    return ExtraRoleObjectPermissionToJSONTyped(json, false);
}

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

    return {
        object_pk: value["objectPk"],
    };
}
