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

  public class IpFw_1_0_1 : ICloneable {
    public object Clone() {
      IpFw_1_0_1 copy = new IpFw_1_0_1();
      copy.enabled = this.enabled;
      copy.defaultPolicy = this.defaultPolicy;
      copy.ruleSet = this.ruleSet;
      return copy;
    }

    public LightJson.JsonObject Encode() {
      LightJson.JsonObject json = new LightJson.JsonObject();
      json["enabled"] = this.enabled;
      json["defaultPolicy"] = (int)this.defaultPolicy;
      json["ruleSet"] = new JsonArray(this.ruleSet.Select(
        _value => (JsonValue)(_value.Encode())));
      return json;
    }

    public static IpFw_1_0_1 Decode(LightJson.JsonObject json, Agent agent) {
      IpFw_1_0_1 inst = new IpFw_1_0_1();
      inst.enabled = (bool)json["enabled"];
      inst.defaultPolicy = (Com.Raritan.Idl.security.IpfwPolicy)(int)json["defaultPolicy"];
      inst.ruleSet = new System.Collections.Generic.List<Com.Raritan.Idl.security.IpfwRule>(json["ruleSet"].AsJsonArray.Select(
        _value => Com.Raritan.Idl.security.IpfwRule.Decode(_value, agent)));
      return inst;
    }

    public bool enabled = false;
    public Com.Raritan.Idl.security.IpfwPolicy defaultPolicy = Com.Raritan.Idl.security.IpfwPolicy.ACCEPT;
    public System.Collections.Generic.IEnumerable<Com.Raritan.Idl.security.IpfwRule> ruleSet = new System.Collections.Generic.List<Com.Raritan.Idl.security.IpfwRule>();
  }
}
