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

    static public readonly new TypeInfo typeInfo = new TypeInfo("portsmodel.PortFuse:1.0.1", null);

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

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

    public enum Status {
      UNKNOWN,
      TRIPPED,
      GOOD,
    }

    public class StatusChangedEvent : Com.Raritan.Idl.idl.Event {
      static public readonly new TypeInfo typeInfo = new TypeInfo("portsmodel.PortFuse_1_0_1.StatusChangedEvent:1.0.0", Com.Raritan.Idl.idl.Event.typeInfo);

      public Com.Raritan.Idl.portsmodel.PortFuse_1_0_1.Status oldStatus = Com.Raritan.Idl.portsmodel.PortFuse_1_0_1.Status.UNKNOWN;
      public Com.Raritan.Idl.portsmodel.PortFuse_1_0_1.Status newStatus = Com.Raritan.Idl.portsmodel.PortFuse_1_0_1.Status.UNKNOWN;
    }

    public class GetStatusResult {
      public Com.Raritan.Idl.portsmodel.PortFuse_1_0_1.Status _ret_;
    }

    public GetStatusResult getStatus() {
      JsonObject _parameters = null;
      var _result = RpcCall("getStatus", _parameters);
      var _ret = new GetStatusResult();
      _ret._ret_ = (Com.Raritan.Idl.portsmodel.PortFuse_1_0_1.Status)(int)_result["_ret_"];
      return _ret;
    }

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

    public AsyncRequest getStatus(AsyncRpcResponse<GetStatusResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      JsonObject _parameters = null;
      return RpcCall("getStatus", _parameters,
        _result => {
          try {
            var _ret = new GetStatusResult();
            _ret._ret_ = (Com.Raritan.Idl.portsmodel.PortFuse_1_0_1.Status)(int)_result["_ret_"];
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

    public class ResetResult {
    }

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

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

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

    public class GetTripCountResult {
      public int _ret_;
    }

    public GetTripCountResult getTripCount() {
      JsonObject _parameters = null;
      var _result = RpcCall("getTripCount", _parameters);
      var _ret = new GetTripCountResult();
      _ret._ret_ = (int)_result["_ret_"];
      return _ret;
    }

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

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

  }
}
