/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { isObject } from "@matter/general";
import { StatusResponse } from "@matter/types";
function RemoteRequest(request) {
  if (!isObject(request)) {
    throw new StatusResponse.InvalidActionError("Request is not an object");
  }
  const { target, method } = request;
  if (typeof method !== "string") {
    throw new 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 StatusResponse.InvalidActionError(`Unsupported request method "${method}"`);
  }
  if (typeof target !== "string") {
    throw new StatusResponse.InvalidActionError('Request does not specify resource in "target" property');
  }
  return request;
}
export {
  RemoteRequest
};
//# sourceMappingURL=RemoteRequest.js.map
