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

  public class ScriptOptions_2_0_0 : ICloneable {
    public object Clone() {
      ScriptOptions_2_0_0 copy = new ScriptOptions_2_0_0();
      copy.defaultArgs = this.defaultArgs;
      copy.autoStart = this.autoStart;
      copy.autoRestart = this.autoRestart;
      return copy;
    }

    public LightJson.JsonObject Encode() {
      LightJson.JsonObject json = new LightJson.JsonObject();
      json["defaultArgs"] = new JsonArray(this.defaultArgs.Select(_entry => (JsonValue) new JsonObject(new System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string, LightJson.JsonValue>> {
        new System.Collections.Generic.KeyValuePair<string, JsonValue>("key", _entry.Key),
        new System.Collections.Generic.KeyValuePair<string, JsonValue>("value", _entry.Value)
      })));
      json["autoStart"] = this.autoStart;
      json["autoRestart"] = this.autoRestart;
      return json;
    }

    public static ScriptOptions_2_0_0 Decode(LightJson.JsonObject json, Agent agent) {
      ScriptOptions_2_0_0 inst = new ScriptOptions_2_0_0();
      inst.defaultArgs = DictionaryHelper.Create(json["defaultArgs"].AsJsonArray.Select(
        _value => new System.Collections.Generic.KeyValuePair<string, string>(_value["key"], (string)_value["value"])));
      inst.autoStart = (bool)json["autoStart"];
      inst.autoRestart = (bool)json["autoRestart"];
      return inst;
    }

    public System.Collections.Generic.IDictionary<string, string> defaultArgs = new System.Collections.Generic.Dictionary<string, string>();
    public bool autoStart = false;
    public bool autoRestart = false;
  }
}
