// 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 SensorLogPushMessage : ICloneable {
    public object Clone() {
      SensorLogPushMessage copy = new SensorLogPushMessage();
      copy.sensors = this.sensors;
      copy.rows = this.rows;
      return copy;
    }

    public LightJson.JsonObject Encode() {
      LightJson.JsonObject json = new LightJson.JsonObject();
      json["sensors"] = new JsonArray(this.sensors.Select(
        _value => (JsonValue)(_value.Encode())));
      json["rows"] = new JsonArray(this.rows.Select(
        _value => (JsonValue)(_value.Encode())));
      return json;
    }

    public static SensorLogPushMessage Decode(LightJson.JsonObject json, Agent agent) {
      SensorLogPushMessage inst = new SensorLogPushMessage();
      inst.sensors = new System.Collections.Generic.List<Com.Raritan.Idl.datapush.Sensor>(json["sensors"].AsJsonArray.Select(
        _value => Com.Raritan.Idl.datapush.Sensor.Decode(_value, agent)));
      inst.rows = new System.Collections.Generic.List<Com.Raritan.Idl.datapush.LogRow>(json["rows"].AsJsonArray.Select(
        _value => Com.Raritan.Idl.datapush.LogRow.Decode(_value, agent)));
      return inst;
    }

    public System.Collections.Generic.IEnumerable<Com.Raritan.Idl.datapush.Sensor> sensors = new System.Collections.Generic.List<Com.Raritan.Idl.datapush.Sensor>();
    public System.Collections.Generic.IEnumerable<Com.Raritan.Idl.datapush.LogRow> rows = new System.Collections.Generic.List<Com.Raritan.Idl.datapush.LogRow>();
  }
}
