"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 target_navigator_exports = {};
__export(target_navigator_exports, {
  TargetNavigator: () => TargetNavigator,
  TargetNavigatorCluster: () => TargetNavigatorCluster
});
module.exports = __toCommonJS(target_navigator_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvArray = require("../tlv/TlvArray.js");
var import_TlvObject = require("../tlv/TlvObject.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_TlvString = require("../tlv/TlvString.js");
var import_StatusResponseError = require("../common/StatusResponseError.js");
var import_Status = require("../globals/Status.js");
var import_Priority = require("../globals/Priority.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var TargetNavigator;
((TargetNavigator2) => {
  TargetNavigator2.TlvTargetInfo = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall contain an unique id within the TargetList.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.11.4.2.1
     */
    identifier: (0, import_TlvObject.TlvField)(0, import_TlvNumber.TlvUInt8.bound({ max: 254 })),
    /**
     * This field shall contain a name string for the TargetInfoStruct.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.11.4.2.2
     */
    name: (0, import_TlvObject.TlvField)(1, import_TlvString.TlvString)
  });
  TargetNavigator2.TlvNavigateTargetRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the Identifier for the target for UX navigation. The Target shall be an Identifier
     * value contained within one of the TargetInfoStruct objects in the TargetList attribute.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.11.6.1.1
     */
    target: (0, import_TlvObject.TlvField)(0, import_TlvNumber.TlvUInt8),
    /**
     * This field shall indicate Optional app-specific data.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.11.6.1.2
     */
    data: (0, import_TlvObject.TlvOptionalField)(1, import_TlvString.TlvString)
  });
  let Status;
  ((Status2) => {
    Status2[Status2["Success"] = 0] = "Success";
    Status2[Status2["TargetNotFound"] = 1] = "TargetNotFound";
    Status2[Status2["NotAllowed"] = 2] = "NotAllowed";
  })(Status = TargetNavigator2.Status || (TargetNavigator2.Status = {}));
  class TargetNotFoundError extends import_StatusResponseError.StatusResponseError {
    constructor(message = "Requested target was not found in the TargetList", code = import_Status.Status.Failure, clusterCode = 1 /* TargetNotFound */) {
      super(message, code, clusterCode);
    }
  }
  TargetNavigator2.TargetNotFoundError = TargetNotFoundError;
  class NotAllowedError extends import_StatusResponseError.StatusResponseError {
    constructor(message = "Target request is not allowed in current state", code = import_Status.Status.Failure, clusterCode = 2 /* NotAllowed */) {
      super(message, code, clusterCode);
    }
  }
  TargetNavigator2.NotAllowedError = NotAllowedError;
  TargetNavigator2.TlvNavigateTargetResponse = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the of the command.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.11.6.2.1
     */
    status: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvEnum)()),
    /**
     * This field shall indicate Optional app-specific data.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 6.11.6.2.2
     */
    data: (0, import_TlvObject.TlvOptionalField)(1, import_TlvString.TlvString)
  });
  TargetNavigator2.TlvTargetUpdatedEvent = (0, import_TlvObject.TlvObject)({
    targetList: (0, import_TlvObject.TlvOptionalField)(0, (0, import_TlvArray.TlvArray)(TargetNavigator2.TlvTargetInfo)),
    currentTarget: (0, import_TlvObject.TlvOptionalField)(1, import_TlvNumber.TlvUInt8),
    data: (0, import_TlvObject.TlvOptionalField)(2, import_TlvString.TlvByteString.bound({ maxLength: 900 }))
  });
  TargetNavigator2.ClusterInstance = (0, import_MutableCluster.MutableCluster)({
    id: 1285,
    name: "TargetNavigator",
    revision: 2,
    attributes: {
      /**
       * Indicates a list of targets that can be navigated to within the experience presented to the user by the
       * Endpoint (Video Player or Content App). The list shall NOT contain any entries with the same Identifier
       * in the TargetInfoStruct object.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.11.5.1
       */
      targetList: (0, import_Cluster.Attribute)(0, (0, import_TlvArray.TlvArray)(TargetNavigator2.TlvTargetInfo), { default: [] }),
      /**
       * Indicates the Identifier for the target which is currently in foreground on the corresponding Endpoint
       * (Video Player or Content App), or 0xFF to indicate that no target is in the foreground.
       *
       * When not 0xFF, the CurrentTarget shall be an Identifier value contained within one of the
       * TargetInfoStruct objects in the TargetList attribute.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.11.5.2
       */
      currentTarget: (0, import_Cluster.OptionalAttribute)(1, import_TlvNumber.TlvUInt8, { default: 255 })
    },
    commands: {
      /**
       * Upon receipt, this shall navigation the UX to the target identified.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.11.6.1
       */
      navigateTarget: (0, import_Cluster.Command)(0, TargetNavigator2.TlvNavigateTargetRequest, 1, TargetNavigator2.TlvNavigateTargetResponse)
    },
    events: {
      /**
       * This event shall be generated when there is a change in either the active target or the list of available
       * targets or both.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 6.11.7.1
       */
      targetUpdated: (0, import_Cluster.OptionalEvent)(0, import_Priority.Priority.Info, TargetNavigator2.TlvTargetUpdatedEvent)
    }
  });
  TargetNavigator2.Cluster = TargetNavigator2.ClusterInstance;
  TargetNavigator2.Complete = TargetNavigator2.Cluster;
})(TargetNavigator || (TargetNavigator = {}));
const TargetNavigatorCluster = TargetNavigator.Cluster;
import_ClusterRegistry.ClusterRegistry.register(TargetNavigator.Complete);
//# sourceMappingURL=target-navigator.js.map
