// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright 2025 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 DnsInfo : ICloneable {
    public object Clone() {
      DnsInfo copy = new DnsInfo();
      copy.serverAddrs = this.serverAddrs;
      copy.searchSuffixes = this.searchSuffixes;
      copy.resolverPrefersIPv6 = this.resolverPrefersIPv6;
      return copy;
    }

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

    public static DnsInfo Decode(LightJson.JsonObject json, Agent agent) {
      DnsInfo inst = new DnsInfo();
      inst.serverAddrs = new System.Collections.Generic.List<string>(json["serverAddrs"].AsJsonArray.Select(
        _value => (string)_value));
      inst.searchSuffixes = new System.Collections.Generic.List<string>(json["searchSuffixes"].AsJsonArray.Select(
        _value => (string)_value));
      inst.resolverPrefersIPv6 = (bool)json["resolverPrefersIPv6"];
      return inst;
    }

    public System.Collections.Generic.IEnumerable<string> serverAddrs = new System.Collections.Generic.List<string>();
    public System.Collections.Generic.IEnumerable<string> searchSuffixes = new System.Collections.Generic.List<string>();
    public bool resolverPrefersIPv6 = false;
  }
}
