/* 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 { Connector } from "./Connector";
import { ConnectorFromJSON } from "./Connector";
import type { DeviceFactSnapshot } from "./DeviceFactSnapshot";
import { DeviceFactSnapshotFromJSON } from "./DeviceFactSnapshot";

/**
 *
 * @export
 * @interface DeviceConnection
 */
export interface DeviceConnection {
    /**
     *
     * @type {string}
     * @memberof DeviceConnection
     */
    device: string;
    /**
     *
     * @type {string}
     * @memberof DeviceConnection
     */
    connector: string;
    /**
     *
     * @type {Connector}
     * @memberof DeviceConnection
     */
    readonly connectorObj: Connector;
    /**
     *
     * @type {DeviceFactSnapshot}
     * @memberof DeviceConnection
     */
    readonly latestSnapshot: DeviceFactSnapshot | null;
}

/**
 * Check if a given object implements the DeviceConnection interface.
 */
export function instanceOfDeviceConnection(value: object): value is DeviceConnection {
    if (!("device" in value) || value["device"] === undefined) return false;
    if (!("connector" in value) || value["connector"] === undefined) return false;
    if (!("connectorObj" in value) || value["connectorObj"] === undefined) return false;
    if (!("latestSnapshot" in value) || value["latestSnapshot"] === undefined) return false;
    return true;
}

export function DeviceConnectionFromJSON(json: any): DeviceConnection {
    return DeviceConnectionFromJSONTyped(json, false);
}

export function DeviceConnectionFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): DeviceConnection {
    if (json == null) {
        return json;
    }
    return {
        device: json["device"],
        connector: json["connector"],
        connectorObj: ConnectorFromJSON(json["connector_obj"]),
        latestSnapshot: DeviceFactSnapshotFromJSON(json["latest_snapshot"]),
    };
}

export function DeviceConnectionToJSON(json: any): DeviceConnection {
    return DeviceConnectionToJSONTyped(json, false);
}

export function DeviceConnectionToJSONTyped(
    value?: Omit<DeviceConnection, "connector_obj" | "latest_snapshot"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        device: value["device"],
        connector: value["connector"],
    };
}
