// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright 2024 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 LanInterfaceParameters_2_0_0 : ICloneable {
    public object Clone() {
      LanInterfaceParameters_2_0_0 copy = new LanInterfaceParameters_2_0_0();
      copy.speed = this.speed;
      copy.duplex = this.duplex;
      copy.autonegotiation = this.autonegotiation;
      copy.link = this.link;
      copy.supportedModes = this.supportedModes;
      return copy;
    }

    public LightJson.JsonObject Encode() {
      LightJson.JsonObject json = new LightJson.JsonObject();
      json["speed"] = (int)this.speed;
      json["duplex"] = (int)this.duplex;
      json["autonegotiation"] = this.autonegotiation;
      json["link"] = this.link;
      json["supportedModes"] = new JsonArray(this.supportedModes.Select(
        _value => (JsonValue)(_value.Encode())));
      return json;
    }

    public static LanInterfaceParameters_2_0_0 Decode(LightJson.JsonObject json, Agent agent) {
      LanInterfaceParameters_2_0_0 inst = new LanInterfaceParameters_2_0_0();
      inst.speed = (Com.Raritan.Idl.net.LanSpeed)(int)json["speed"];
      inst.duplex = (Com.Raritan.Idl.net.LanDuplex)(int)json["duplex"];
      inst.autonegotiation = (bool)json["autonegotiation"];
      inst.link = (bool)json["link"];
      inst.supportedModes = new System.Collections.Generic.List<Com.Raritan.Idl.net.LanLinkMode>(json["supportedModes"].AsJsonArray.Select(
        _value => Com.Raritan.Idl.net.LanLinkMode.Decode(_value, agent)));
      return inst;
    }

    public Com.Raritan.Idl.net.LanSpeed speed = Com.Raritan.Idl.net.LanSpeed.LAN_SPEED_AUTO;
    public Com.Raritan.Idl.net.LanDuplex duplex = Com.Raritan.Idl.net.LanDuplex.LAN_DUPLEX_AUTO;
    public bool autonegotiation = false;
    public bool link = false;
    public System.Collections.Generic.IEnumerable<Com.Raritan.Idl.net.LanLinkMode> supportedModes = new System.Collections.Generic.List<Com.Raritan.Idl.net.LanLinkMode>();
  }
}
