// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright 2025 Raritan Inc. All rights reserved.
//
// This file was generated by IdlC from ExternalSensorSlot.idl.

using System;
using System.Linq;
using LightJson;
using Com.Raritan.Idl;
using Com.Raritan.JsonRpc;
using Com.Raritan.Util;

#pragma warning disable 0108, 0219, 0414, 1591

namespace Com.Raritan.Idl.sensors {

  public class ExternalSensorData : ICloneable {
    public object Clone() {
      ExternalSensorData copy = new ExternalSensorData();
      copy.sensorClass = this.sensorClass;
      copy.id = this.id;
      copy.serial = this.serial;
      copy.type = this.type;
      copy.channel = this.channel;
      copy.port = this.port;
      return copy;
    }

    public LightJson.JsonObject Encode() {
      LightJson.JsonObject json = new LightJson.JsonObject();
      json["sensorClass"] = this.sensorClass;
      json["id"] = this.id;
      json["serial"] = this.serial;
      json["type"] = this.type.Encode();
      json["channel"] = this.channel;
      json["port"] = this.port;
      return json;
    }

    public static ExternalSensorData Decode(LightJson.JsonObject json, Agent agent) {
      ExternalSensorData inst = new ExternalSensorData();
      inst.sensorClass = (string)json["sensorClass"];
      inst.id = (string)json["id"];
      inst.serial = (string)json["serial"];
      inst.type = Com.Raritan.Idl.sensors.Sensor.TypeSpec.Decode(json["type"], agent);
      inst.channel = (int)json["channel"];
      inst.port = (string)json["port"];
      return inst;
    }

    public string sensorClass = "";
    public string id = "";
    public string serial = "";
    public Com.Raritan.Idl.sensors.Sensor.TypeSpec type = new Com.Raritan.Idl.sensors.Sensor.TypeSpec();
    public int channel = 0;
    public string port = "";
  }
}
