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

    static public readonly new TypeInfo typeInfo = new TypeInfo("lhx.Support:1.0.0", null);

    public Support(Agent agent, string rid, TypeInfo ti) : base(agent, rid, ti) {}
    public Support(Agent agent, string rid) : this(agent, rid, typeInfo) {}

    public static new Support StaticCast(ObjectProxy proxy) {
      return proxy == null ? null : new Support(proxy.Agent, proxy.Rid, proxy.StaticTypeInfo);
    }

    public class SetEnabledResult {
    }

    public SetEnabledResult setEnabled(bool enabled) {
      var _parameters = new LightJson.JsonObject();
      _parameters["enabled"] = enabled;

      var _result = RpcCall("setEnabled", _parameters);
      var _ret = new SetEnabledResult();
      return _ret;
    }

    public AsyncRequest setEnabled(bool enabled, AsyncRpcResponse<SetEnabledResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail) {
      return setEnabled(enabled, rsp, fail, RpcCtrl.Default);
    }

    public AsyncRequest setEnabled(bool enabled, AsyncRpcResponse<SetEnabledResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      var _parameters = new LightJson.JsonObject();
      try {
        _parameters["enabled"] = enabled;
      } catch (Exception e) {
        if (fail != null) fail(e);
      }

      return RpcCall("setEnabled", _parameters,
        _result => {
          try {
            var _ret = new SetEnabledResult();
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

    public class IsEnabledResult {
      public bool _ret_;
    }

    public IsEnabledResult isEnabled() {
      JsonObject _parameters = null;
      var _result = RpcCall("isEnabled", _parameters);
      var _ret = new IsEnabledResult();
      _ret._ret_ = (bool)_result["_ret_"];
      return _ret;
    }

    public AsyncRequest isEnabled(AsyncRpcResponse<IsEnabledResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail) {
      return isEnabled(rsp, fail, RpcCtrl.Default);
    }

    public AsyncRequest isEnabled(AsyncRpcResponse<IsEnabledResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      JsonObject _parameters = null;
      return RpcCall("isEnabled", _parameters,
        _result => {
          try {
            var _ret = new IsEnabledResult();
            _ret._ret_ = (bool)_result["_ret_"];
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

  }
}
