/* 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 { DeviceAccessGroup } from "./DeviceAccessGroup";
import { DeviceAccessGroupFromJSON, DeviceAccessGroupToJSON } from "./DeviceAccessGroup";
import type { DeviceFactSnapshot } from "./DeviceFactSnapshot";
import { DeviceFactSnapshotFromJSON } from "./DeviceFactSnapshot";

/**
 *
 * @export
 * @interface EndpointDevice
 */
export interface EndpointDevice {
    /**
     *
     * @type {string}
     * @memberof EndpointDevice
     */
    deviceUuid?: string;
    /**
     *
     * @type {string}
     * @memberof EndpointDevice
     */
    readonly pbmUuid: string;
    /**
     *
     * @type {string}
     * @memberof EndpointDevice
     */
    name: string;
    /**
     *
     * @type {string}
     * @memberof EndpointDevice
     */
    accessGroup?: string | null;
    /**
     *
     * @type {DeviceAccessGroup}
     * @memberof EndpointDevice
     */
    accessGroupObj?: DeviceAccessGroup;
    /**
     *
     * @type {boolean}
     * @memberof EndpointDevice
     */
    expiring?: boolean;
    /**
     *
     * @type {Date}
     * @memberof EndpointDevice
     */
    expires?: Date | null;
    /**
     *
     * @type {DeviceFactSnapshot}
     * @memberof EndpointDevice
     */
    readonly facts: DeviceFactSnapshot;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof EndpointDevice
     */
    attributes?: { [key: string]: any };
}

/**
 * Check if a given object implements the EndpointDevice interface.
 */
export function instanceOfEndpointDevice(value: object): value is EndpointDevice {
    if (!("pbmUuid" in value) || value["pbmUuid"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("facts" in value) || value["facts"] === undefined) return false;
    return true;
}

export function EndpointDeviceFromJSON(json: any): EndpointDevice {
    return EndpointDeviceFromJSONTyped(json, false);
}

export function EndpointDeviceFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): EndpointDevice {
    if (json == null) {
        return json;
    }
    return {
        deviceUuid: json["device_uuid"] == null ? undefined : json["device_uuid"],
        pbmUuid: json["pbm_uuid"],
        name: json["name"],
        accessGroup: json["access_group"] == null ? undefined : json["access_group"],
        accessGroupObj:
            json["access_group_obj"] == null
                ? undefined
                : DeviceAccessGroupFromJSON(json["access_group_obj"]),
        expiring: json["expiring"] == null ? undefined : json["expiring"],
        expires: json["expires"] == null ? undefined : new Date(json["expires"]),
        facts: DeviceFactSnapshotFromJSON(json["facts"]),
        attributes: json["attributes"] == null ? undefined : json["attributes"],
    };
}

export function EndpointDeviceToJSON(json: any): EndpointDevice {
    return EndpointDeviceToJSONTyped(json, false);
}

export function EndpointDeviceToJSONTyped(
    value?: Omit<EndpointDevice, "pbm_uuid" | "facts"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        device_uuid: value["deviceUuid"],
        name: value["name"],
        access_group: value["accessGroup"],
        access_group_obj: DeviceAccessGroupToJSON(value["accessGroupObj"]),
        expiring: value["expiring"],
        expires: value["expires"] == null ? value["expires"] : value["expires"].toISOString(),
        attributes: value["attributes"],
    };
}
