// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright 2020 Raritan Inc. All rights reserved.
//
// This file was generated by IdlC from sensorpush.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.datapush {

  public class Sensor : ICloneable {
    public object Clone() {
      Sensor copy = new Sensor();
      copy.device = this.device;
      copy.id = this.id;
      copy.readingtype = this.readingtype;
      copy.metadata = this.metadata;
      return copy;
    }

    public LightJson.JsonObject Encode() {
      LightJson.JsonObject json = new LightJson.JsonObject();
      json["device"] = this.device.Encode();
      json["id"] = this.id;
      json["readingtype"] = this.readingtype;
      json["metadata"] = this.metadata.Encode();
      return json;
    }

    public static Sensor Decode(LightJson.JsonObject json, Agent agent) {
      Sensor inst = new Sensor();
      inst.device = Com.Raritan.Idl.datapush.Device.Decode(json["device"], agent);
      inst.id = (string)json["id"];
      inst.readingtype = (int)json["readingtype"];
      inst.metadata = Com.Raritan.Idl.sensors.NumericSensor_4_0_3.MetaData.Decode(json["metadata"], agent);
      return inst;
    }

    public Com.Raritan.Idl.datapush.Device device = new Com.Raritan.Idl.datapush.Device();
    public string id = "";
    public int readingtype = 0;
    public Com.Raritan.Idl.sensors.NumericSensor_4_0_3.MetaData metadata = new Com.Raritan.Idl.sensors.NumericSensor_4_0_3.MetaData();
  }
}
