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

    static public readonly new TypeInfo typeInfo = new TypeInfo("hmi.InternalBeeper:2.0.1", null);

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

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

    public enum State {
      OFF,
      ON_NOTIFICATION,
      ON_ACTIVATION,
    }

    public class MuteChangedEvent : Com.Raritan.Idl._event.UserEvent {
      static public readonly new TypeInfo typeInfo = new TypeInfo("hmi.InternalBeeper_2_0_1.MuteChangedEvent:1.0.0", Com.Raritan.Idl._event.UserEvent.typeInfo);

      public bool muted = false;
    }

    public class StateChangedEvent : Com.Raritan.Idl.idl.Event {
      static public readonly new TypeInfo typeInfo = new TypeInfo("hmi.InternalBeeper_2_0_1.StateChangedEvent:1.0.0", Com.Raritan.Idl.idl.Event.typeInfo);

      public Com.Raritan.Idl.hmi.InternalBeeper_2_0_1.State state = Com.Raritan.Idl.hmi.InternalBeeper_2_0_1.State.OFF;
      public string reason = "";
      public bool mutedTemporarily = false;
    }

    public class MuteResult {
    }

    public MuteResult mute(bool muted) {
      var _parameters = new LightJson.JsonObject();
      _parameters["muted"] = muted;

      var _result = RpcCall("mute", _parameters);
      var _ret = new MuteResult();
      return _ret;
    }

    public AsyncRequest mute(bool muted, AsyncRpcResponse<MuteResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail) {
      return mute(muted, rsp, fail, RpcCtrl.Default);
    }

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

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

    public class IsMutedResult {
      public bool _ret_;
    }

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

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

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

    public class ActivateResult {
    }

    public ActivateResult activate(bool on, string reason, int timeout) {
      var _parameters = new LightJson.JsonObject();
      _parameters["on"] = on;
      _parameters["reason"] = reason;
      _parameters["timeout"] = timeout;

      var _result = RpcCall("activate", _parameters);
      var _ret = new ActivateResult();
      return _ret;
    }

    public AsyncRequest activate(bool on, string reason, int timeout, AsyncRpcResponse<ActivateResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail) {
      return activate(on, reason, timeout, rsp, fail, RpcCtrl.Default);
    }

    public AsyncRequest activate(bool on, string reason, int timeout, AsyncRpcResponse<ActivateResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      var _parameters = new LightJson.JsonObject();
      try {
        _parameters["on"] = on;
        _parameters["reason"] = reason;
        _parameters["timeout"] = timeout;
      } catch (Exception e) {
        if (fail != null) fail(e);
      }

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

    public class GetStateResult {
      public Com.Raritan.Idl.hmi.InternalBeeper_2_0_1.State _ret_;
      public string reason;
      public bool mutedTemporarily;
    }

    public GetStateResult getState() {
      JsonObject _parameters = null;
      var _result = RpcCall("getState", _parameters);
      var _ret = new GetStateResult();
      _ret._ret_ = (Com.Raritan.Idl.hmi.InternalBeeper_2_0_1.State)(int)_result["_ret_"];
      _ret.reason = (string)_result["reason"];
      _ret.mutedTemporarily = (bool)_result["mutedTemporarily"];
      return _ret;
    }

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

    public AsyncRequest getState(AsyncRpcResponse<GetStateResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      JsonObject _parameters = null;
      return RpcCall("getState", _parameters,
        _result => {
          try {
            var _ret = new GetStateResult();
            _ret._ret_ = (Com.Raritan.Idl.hmi.InternalBeeper_2_0_1.State)(int)_result["_ret_"];
            _ret.reason = (string)_result["reason"];
            _ret.mutedTemporarily = (bool)_result["mutedTemporarily"];
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

    public class MuteCurrentActivationResult {
    }

    public MuteCurrentActivationResult muteCurrentActivation() {
      JsonObject _parameters = null;
      var _result = RpcCall("muteCurrentActivation", _parameters);
      var _ret = new MuteCurrentActivationResult();
      return _ret;
    }

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

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

  }
}
