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

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

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

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

    public class GetWebcamIDsResult {
      public System.Collections.Generic.IEnumerable<string> _ret_;
    }

    public GetWebcamIDsResult getWebcamIDs() {
      JsonObject _parameters = null;
      var _result = RpcCall("getWebcamIDs", _parameters);
      var _ret = new GetWebcamIDsResult();
      _ret._ret_ = new System.Collections.Generic.List<string>(_result["_ret_"].AsJsonArray.Select(
        _value => (string)_value));
      return _ret;
    }

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

    public AsyncRequest getWebcamIDs(AsyncRpcResponse<GetWebcamIDsResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      JsonObject _parameters = null;
      return RpcCall("getWebcamIDs", _parameters,
        _result => {
          try {
            var _ret = new GetWebcamIDsResult();
            _ret._ret_ = new System.Collections.Generic.List<string>(_result["_ret_"].AsJsonArray.Select(
              _value => (string)_value));
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

  }
}
