/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { InvalidGroupOperationError } from "#endpoint/errors.js";
import { ClientNodeInteraction } from "./ClientNodeInteraction.js";
class ClientGroupInteraction extends ClientNodeInteraction {
  /** Groups do not support reading or subscribing to attributes */
  read(_request, _context) {
    throw new InvalidGroupOperationError("Groups do not support reading attributes");
  }
  /** Groups do not support reading or subscribing to attributes */
  async subscribe(_request, _context) {
    throw new InvalidGroupOperationError("Groups do not support subscribing to attributes");
  }
  async write(request, context) {
    if (request.timedRequest) {
      throw new InvalidGroupOperationError("Timed requests are not supported for group address writes.");
    }
    if (request.suppressResponse === false) {
      throw new InvalidGroupOperationError("Writing attributes on a group address can not return a response.");
    }
    if (request.writeRequests.some(
      ({ path: { endpointId, clusterId, attributeId } }) => endpointId !== void 0 || clusterId === void 0 || attributeId === void 0
    )) {
      throw new InvalidGroupOperationError("Not all attribute write paths are valid for group address writes.");
    }
    return super.write({ ...request, suppressResponse: true }, context);
  }
  invoke(request, context) {
    if (request.invokeRequests.some(({ commandPath: { endpointId } }) => endpointId !== void 0)) {
      throw new InvalidGroupOperationError("Invoking a concrete command on a group address is not supported.");
    }
    if (request.timedRequest) {
      throw new InvalidGroupOperationError("Timed requests are not supported for group address invokes.");
    }
    request.suppressResponse = true;
    return super.invoke(request, context);
  }
}
export {
  ClientGroupInteraction,
  InvalidGroupOperationError
};
//# sourceMappingURL=ClientGroupInteraction.js.map
