/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MutableCluster } from "../cluster/mutation/MutableCluster.js";
import { Command } from "../cluster/Cluster.js";
import { TlvField, TlvOptionalField, TlvObject } from "../tlv/TlvObject.js";
import { TlvString } from "../tlv/TlvString.js";
import { StatusResponseError } from "../common/StatusResponseError.js";
import { Status as GlobalStatus } from "../globals/Status.js";
import { TlvEnum } from "../tlv/TlvNumber.js";
import { ClusterRegistry } from "../cluster/ClusterRegistry.js";
var ContentAppObserver;
((ContentAppObserver2) => {
  ContentAppObserver2.TlvContentAppMessageRequest = TlvObject({
    /**
     * This field shall indicate content app-specific data.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.12.5.1.1
     */
    data: TlvField(0, TlvString.bound({ maxLength: 500 })),
    /**
     * This optional field shall indicate a content app-specific hint to the encoding of the data.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.12.5.1.2
     */
    encodingHint: TlvOptionalField(1, TlvString.bound({ maxLength: 100 }))
  });
  let Status;
  ((Status2) => {
    Status2[Status2["Success"] = 0] = "Success";
    Status2[Status2["UnexpectedData"] = 1] = "UnexpectedData";
  })(Status = ContentAppObserver2.Status || (ContentAppObserver2.Status = {}));
  class UnexpectedDataError extends StatusResponseError {
    constructor(message = "Data field in command was not understood by the Observer", code = GlobalStatus.Failure, clusterCode = 1 /* UnexpectedData */) {
      super(message, code, clusterCode);
    }
  }
  ContentAppObserver2.UnexpectedDataError = UnexpectedDataError;
  ContentAppObserver2.TlvContentAppMessageResponse = TlvObject({
    /**
     * This field shall indicate the status of the command which resulted in this response.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.12.5.2.1
     */
    status: TlvField(0, TlvEnum()),
    /**
     * This optional field shall indicate content app-specific data.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.12.5.2.2
     */
    data: TlvOptionalField(1, TlvString.bound({ maxLength: 500 })),
    /**
     * This optional field shall indicate a content app-specific hint to the encoding of the data.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.12.5.2.3
     */
    encodingHint: TlvOptionalField(2, TlvString.bound({ maxLength: 100 }))
  });
  ContentAppObserver2.ClusterInstance = MutableCluster({
    id: 1296,
    name: "ContentAppObserver",
    revision: 1,
    commands: {
      /**
       * Upon receipt, the data field may be parsed and interpreted. Message encoding is specific to the Content
       * App. A Content App may when possible read attributes from the Basic Information Cluster on the Observer
       * and use this to determine the Message encoding.
       *
       * This command returns a ContentAppMessage Response.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.12.5.1
       */
      contentAppMessage: Command(0, ContentAppObserver2.TlvContentAppMessageRequest, 1, ContentAppObserver2.TlvContentAppMessageResponse)
    }
  });
  ContentAppObserver2.Cluster = ContentAppObserver2.ClusterInstance;
  ContentAppObserver2.Complete = ContentAppObserver2.Cluster;
})(ContentAppObserver || (ContentAppObserver = {}));
const ContentAppObserverCluster = ContentAppObserver.Cluster;
ClusterRegistry.register(ContentAppObserver.Complete);
export {
  ContentAppObserver,
  ContentAppObserverCluster
};
//# sourceMappingURL=content-app-observer.js.map
