"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var RemoteRequest_exports = {};
__export(RemoteRequest_exports, {
  RemoteRequest: () => RemoteRequest
});
module.exports = __toCommonJS(RemoteRequest_exports);
var import_general = require("#general");
var import_types = require("#types");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
function RemoteRequest(request) {
  if (!(0, import_general.isObject)(request)) {
    throw new import_types.StatusResponse.InvalidActionError("Request is not an object");
  }
  const { target, method } = request;
  if (typeof method !== "string") {
    throw new import_types.StatusResponse.InvalidActionError('Request does not specify opcode in "method" property');
  }
  switch (method) {
    case "read":
    case "write":
    case "add":
    case "delete":
    case "invoke":
    case "subscribe":
      break;
    default:
      throw new import_types.StatusResponse.InvalidActionError(`Unsupported request method "${method}"`);
  }
  if (typeof target !== "string") {
    throw new import_types.StatusResponse.InvalidActionError('Request does not specify resource in "target" property');
  }
  return request;
}
//# sourceMappingURL=RemoteRequest.js.map
