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

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

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

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

    public class SettingsChangedEvent : Com.Raritan.Idl._event.UserEvent {
      static public readonly new TypeInfo typeInfo = new TypeInfo("webcam.Webcam_2_0_1.SettingsChangedEvent:1.0.0", Com.Raritan.Idl._event.UserEvent.typeInfo);

      public Com.Raritan.Idl.webcam.Settings_2_0_0 oldSettings = new Com.Raritan.Idl.webcam.Settings_2_0_0();
      public Com.Raritan.Idl.webcam.Settings_2_0_0 newSettings = new Com.Raritan.Idl.webcam.Settings_2_0_0();
    }

    public class GetInformationResult {
      public Com.Raritan.Idl.webcam.Information_3_0_0 _ret_;
    }

    public GetInformationResult getInformation() {
      JsonObject _parameters = null;
      var _result = RpcCall("getInformation", _parameters);
      var _ret = new GetInformationResult();
      _ret._ret_ = Com.Raritan.Idl.webcam.Information_3_0_0.Decode(_result["_ret_"], agent);
      return _ret;
    }

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

    public AsyncRequest getInformation(AsyncRpcResponse<GetInformationResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      JsonObject _parameters = null;
      return RpcCall("getInformation", _parameters,
        _result => {
          try {
            var _ret = new GetInformationResult();
            _ret._ret_ = Com.Raritan.Idl.webcam.Information_3_0_0.Decode(_result["_ret_"], agent);
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

    public class GetSettingsResult {
      public Com.Raritan.Idl.webcam.Settings_2_0_0 _ret_;
    }

    public GetSettingsResult getSettings() {
      JsonObject _parameters = null;
      var _result = RpcCall("getSettings", _parameters);
      var _ret = new GetSettingsResult();
      _ret._ret_ = Com.Raritan.Idl.webcam.Settings_2_0_0.Decode(_result["_ret_"], agent);
      return _ret;
    }

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

    public AsyncRequest getSettings(AsyncRpcResponse<GetSettingsResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      JsonObject _parameters = null;
      return RpcCall("getSettings", _parameters,
        _result => {
          try {
            var _ret = new GetSettingsResult();
            _ret._ret_ = Com.Raritan.Idl.webcam.Settings_2_0_0.Decode(_result["_ret_"], agent);
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

    public class SetSettingsResult {
      public int _ret_;
    }

    public SetSettingsResult setSettings(Com.Raritan.Idl.webcam.Settings_2_0_0 settings) {
      var _parameters = new LightJson.JsonObject();
      _parameters["settings"] = settings.Encode();

      var _result = RpcCall("setSettings", _parameters);
      var _ret = new SetSettingsResult();
      _ret._ret_ = (int)_result["_ret_"];
      return _ret;
    }

    public AsyncRequest setSettings(Com.Raritan.Idl.webcam.Settings_2_0_0 settings, AsyncRpcResponse<SetSettingsResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail) {
      return setSettings(settings, rsp, fail, RpcCtrl.Default);
    }

    public AsyncRequest setSettings(Com.Raritan.Idl.webcam.Settings_2_0_0 settings, AsyncRpcResponse<SetSettingsResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      var _parameters = new LightJson.JsonObject();
      try {
        _parameters["settings"] = settings.Encode();
      } catch (Exception e) {
        if (fail != null) fail(e);
      }

      return RpcCall("setSettings", _parameters,
        _result => {
          try {
            var _ret = new SetSettingsResult();
            _ret._ret_ = (int)_result["_ret_"];
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

    public class SetControlsResult {
      public int _ret_;
    }

    public SetControlsResult setControls(Com.Raritan.Idl.webcam.Controls controls) {
      var _parameters = new LightJson.JsonObject();
      _parameters["controls"] = controls.Encode();

      var _result = RpcCall("setControls", _parameters);
      var _ret = new SetControlsResult();
      _ret._ret_ = (int)_result["_ret_"];
      return _ret;
    }

    public AsyncRequest setControls(Com.Raritan.Idl.webcam.Controls controls, AsyncRpcResponse<SetControlsResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail) {
      return setControls(controls, rsp, fail, RpcCtrl.Default);
    }

    public AsyncRequest setControls(Com.Raritan.Idl.webcam.Controls controls, AsyncRpcResponse<SetControlsResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      var _parameters = new LightJson.JsonObject();
      try {
        _parameters["controls"] = controls.Encode();
      } catch (Exception e) {
        if (fail != null) fail(e);
      }

      return RpcCall("setControls", _parameters,
        _result => {
          try {
            var _ret = new SetControlsResult();
            _ret._ret_ = (int)_result["_ret_"];
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

    public class GetControlDefaultsResult {
      public Com.Raritan.Idl.webcam.Controls _ret_;
    }

    public GetControlDefaultsResult getControlDefaults() {
      JsonObject _parameters = null;
      var _result = RpcCall("getControlDefaults", _parameters);
      var _ret = new GetControlDefaultsResult();
      _ret._ret_ = Com.Raritan.Idl.webcam.Controls.Decode(_result["_ret_"], agent);
      return _ret;
    }

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

    public AsyncRequest getControlDefaults(AsyncRpcResponse<GetControlDefaultsResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      JsonObject _parameters = null;
      return RpcCall("getControlDefaults", _parameters,
        _result => {
          try {
            var _ret = new GetControlDefaultsResult();
            _ret._ret_ = Com.Raritan.Idl.webcam.Controls.Decode(_result["_ret_"], agent);
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

  }
}
