"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 occupancy_sensing_exports = {};
__export(occupancy_sensing_exports, {
  OccupancySensing: () => OccupancySensing,
  OccupancySensingCluster: () => OccupancySensingCluster
});
module.exports = __toCommonJS(occupancy_sensing_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_BitmapSchema = require("../schema/BitmapSchema.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_model = require("#model");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var OccupancySensing;
((OccupancySensing2) => {
  OccupancySensing2.Occupancy = {
    /**
     * Indicates the sensed occupancy state
     *
     * If this bit is set, it shall indicate the occupied state else if the bit if not set, it shall indicate the
     * unoccupied state.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 2.7.4.1.1
     */
    occupied: (0, import_BitmapSchema.BitFlag)(0)
  };
  let OccupancySensorType;
  ((OccupancySensorType2) => {
    OccupancySensorType2[OccupancySensorType2["Pir"] = 0] = "Pir";
    OccupancySensorType2[OccupancySensorType2["Ultrasonic"] = 1] = "Ultrasonic";
    OccupancySensorType2[OccupancySensorType2["PirAndUltrasonic"] = 2] = "PirAndUltrasonic";
    OccupancySensorType2[OccupancySensorType2["PhysicalContact"] = 3] = "PhysicalContact";
  })(OccupancySensorType = OccupancySensing2.OccupancySensorType || (OccupancySensing2.OccupancySensorType = {}));
  OccupancySensing2.OccupancySensorTypeBitmap = {
    /**
     * Indicates a passive infrared sensor.
     */
    pir: (0, import_BitmapSchema.BitFlag)(0),
    /**
     * Indicates a ultrasonic sensor.
     */
    ultrasonic: (0, import_BitmapSchema.BitFlag)(1),
    /**
     * Indicates a physical contact sensor.
     */
    physicalContact: (0, import_BitmapSchema.BitFlag)(2)
  };
  OccupancySensing2.ClusterInstance = (0, import_MutableCluster.MutableCluster)({
    id: 1030,
    name: "OccupancySensing",
    revision: 4,
    attributes: {
      /**
       * This attribute indicates the sensed (processed) status of occupancy.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.1
       */
      occupancy: (0, import_Cluster.Attribute)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, OccupancySensing2.Occupancy)),
      /**
       * This attribute specifies the type of the occupancy sensor.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.2
       */
      occupancySensorType: (0, import_Cluster.Attribute)(1, (0, import_TlvNumber.TlvEnum)()),
      /**
       * This attribute specifies the types of the occupancy sensor. Each bit position, if set, indicates the
       * corresponding sensing capability is implemented.
       *
       * The value of the OccupancySensorType shall be aligned to the value of the OccupancySensorTypeBitmap
       * attribute as defined below.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.3
       */
      occupancySensorTypeBitmap: (0, import_Cluster.Attribute)(2, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, OccupancySensing2.OccupancySensorTypeBitmap)),
      /**
       * This attribute specifies the time delay, in seconds, before the PIR sensor changes to its unoccupied
       * state after the last detection of movement in the sensed area.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.4
       */
      pirOccupiedToUnoccupiedDelay: (0, import_Cluster.OptionalWritableAttribute)(
        16,
        import_TlvNumber.TlvUInt16,
        { default: 0, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute specifies the time delay, in seconds, before the PIR sensor changes to its occupied state
       * after the detection of movement in the sensed area.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.5
       */
      pirUnoccupiedToOccupiedDelay: (0, import_Cluster.OptionalWritableAttribute)(
        17,
        import_TlvNumber.TlvUInt16,
        { default: 0, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute specifies the number of movement detection events that must occur in the period
       * PIRUnoccupiedToOccupiedDelay, before the PIR sensor changes to its occupied state.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.6
       */
      pirUnoccupiedToOccupiedThreshold: (0, import_Cluster.OptionalWritableAttribute)(
        18,
        import_TlvNumber.TlvUInt8.bound({ min: 1, max: 254 }),
        { default: 1, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute specifies the time delay, in seconds, before the Ultrasonic sensor changes to its
       * unoccupied state after the last detection of movement in the sensed area.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.7
       */
      ultrasonicOccupiedToUnoccupiedDelay: (0, import_Cluster.OptionalWritableAttribute)(
        32,
        import_TlvNumber.TlvUInt16,
        { default: 0, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute specifies the time delay, in seconds, before the Ultrasonic sensor changes to its
       * occupied state after the detection of movement in the sensed area.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.8
       */
      ultrasonicUnoccupiedToOccupiedDelay: (0, import_Cluster.OptionalWritableAttribute)(
        33,
        import_TlvNumber.TlvUInt16,
        { default: 0, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute specifies the number of movement detection events that must occur in the period
       * UltrasonicUnoccupiedToOccupiedDelay, before the Ultrasonic sensor changes to its occupied state.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.9
       */
      ultrasonicUnoccupiedToOccupiedThreshold: (0, import_Cluster.OptionalWritableAttribute)(
        34,
        import_TlvNumber.TlvUInt8.bound({ min: 1, max: 254 }),
        { default: 1, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute specifies the time delay, in seconds, before the physical contact occupancy sensor
       * changes to its unoccupied state after detecting the unoccupied event.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.10
       */
      physicalContactOccupiedToUnoccupiedDelay: (0, import_Cluster.OptionalWritableAttribute)(
        48,
        import_TlvNumber.TlvUInt16,
        { default: 0, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute specifies the time delay, in seconds, before the physical contact sensor changes to its
       * occupied state after the detection of the occupied event.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.11
       */
      physicalContactUnoccupiedToOccupiedDelay: (0, import_Cluster.OptionalWritableAttribute)(
        49,
        import_TlvNumber.TlvUInt16,
        { default: 0, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute specifies the number of movement detection events that must occur in the period
       * PhysicalContactUnoccupiedToOccupiedDelay, before the PhysicalContact sensor changes to its occupied
       * state.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.7.5.12
       */
      physicalContactUnoccupiedToOccupiedThreshold: (0, import_Cluster.OptionalWritableAttribute)(
        50,
        import_TlvNumber.TlvUInt8.bound({ min: 1, max: 254 }),
        { default: 1, writeAcl: import_model.AccessLevel.Manage }
      )
    }
  });
  OccupancySensing2.Cluster = OccupancySensing2.ClusterInstance;
  OccupancySensing2.Complete = OccupancySensing2.Cluster;
})(OccupancySensing || (OccupancySensing = {}));
const OccupancySensingCluster = OccupancySensing.Cluster;
import_ClusterRegistry.ClusterRegistry.register(OccupancySensing.Complete);
//# sourceMappingURL=occupancy-sensing.js.map
