/* 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 { UsedByActionEnum } from "./UsedByActionEnum";
import { UsedByActionEnumFromJSON, UsedByActionEnumToJSON } from "./UsedByActionEnum";

/**
 * A list of all objects referencing the queried object
 * @export
 * @interface UsedBy
 */
export interface UsedBy {
    /**
     *
     * @type {string}
     * @memberof UsedBy
     */
    app: string;
    /**
     *
     * @type {string}
     * @memberof UsedBy
     */
    modelName: string;
    /**
     *
     * @type {string}
     * @memberof UsedBy
     */
    pk: string;
    /**
     *
     * @type {string}
     * @memberof UsedBy
     */
    name: string;
    /**
     *
     * @type {UsedByActionEnum}
     * @memberof UsedBy
     */
    action: UsedByActionEnum;
}

/**
 * Check if a given object implements the UsedBy interface.
 */
export function instanceOfUsedBy(value: object): value is UsedBy {
    if (!("app" in value) || value["app"] === undefined) return false;
    if (!("modelName" in value) || value["modelName"] === undefined) return false;
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("action" in value) || value["action"] === undefined) return false;
    return true;
}

export function UsedByFromJSON(json: any): UsedBy {
    return UsedByFromJSONTyped(json, false);
}

export function UsedByFromJSONTyped(json: any, ignoreDiscriminator: boolean): UsedBy {
    if (json == null) {
        return json;
    }
    return {
        app: json["app"],
        modelName: json["model_name"],
        pk: json["pk"],
        name: json["name"],
        action: UsedByActionEnumFromJSON(json["action"]),
    };
}

export function UsedByToJSON(json: any): UsedBy {
    return UsedByToJSONTyped(json, false);
}

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

    return {
        app: value["app"],
        model_name: value["modelName"],
        pk: value["pk"],
        name: value["name"],
        action: UsedByActionEnumToJSON(value["action"]),
    };
}
