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

  public class RoutingInfo : ICloneable {
    public object Clone() {
      RoutingInfo copy = new RoutingInfo();
      copy.ipv4Routes = this.ipv4Routes;
      copy.ipv6Routes = this.ipv6Routes;
      return copy;
    }

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

    public static RoutingInfo Decode(LightJson.JsonObject json, Agent agent) {
      RoutingInfo inst = new RoutingInfo();
      inst.ipv4Routes = new System.Collections.Generic.List<Com.Raritan.Idl.net.IpRoute>(json["ipv4Routes"].AsJsonArray.Select(
        _value => Com.Raritan.Idl.net.IpRoute.Decode(_value, agent)));
      inst.ipv6Routes = new System.Collections.Generic.List<Com.Raritan.Idl.net.IpRoute>(json["ipv6Routes"].AsJsonArray.Select(
        _value => Com.Raritan.Idl.net.IpRoute.Decode(_value, agent)));
      return inst;
    }

    public System.Collections.Generic.IEnumerable<Com.Raritan.Idl.net.IpRoute> ipv4Routes = new System.Collections.Generic.List<Com.Raritan.Idl.net.IpRoute>();
    public System.Collections.Generic.IEnumerable<Com.Raritan.Idl.net.IpRoute> ipv6Routes = new System.Collections.Generic.List<Com.Raritan.Idl.net.IpRoute>();
  }
}
