"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 boolean_state_configuration_exports = {};
__export(boolean_state_configuration_exports, {
  BooleanStateConfiguration: () => BooleanStateConfiguration,
  BooleanStateConfigurationCluster: () => BooleanStateConfigurationCluster
});
module.exports = __toCommonJS(boolean_state_configuration_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_BitmapSchema = require("../schema/BitmapSchema.js");
var import_TlvObject = require("../tlv/TlvObject.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 BooleanStateConfiguration;
((BooleanStateConfiguration2) => {
  let Feature;
  ((Feature2) => {
    Feature2["Visual"] = "Visual";
    Feature2["Audible"] = "Audible";
    Feature2["AlarmSuppress"] = "AlarmSuppress";
    Feature2["SensitivityLevel"] = "SensitivityLevel";
  })(Feature = BooleanStateConfiguration2.Feature || (BooleanStateConfiguration2.Feature = {}));
  BooleanStateConfiguration2.AlarmMode = {
    /**
     * Visual alarming
     */
    visual: (0, import_BitmapSchema.BitFlag)(0),
    /**
     * Audible alarming
     */
    audible: (0, import_BitmapSchema.BitFlag)(1)
  };
  BooleanStateConfiguration2.TlvEnableDisableAlarmRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the alarm modes to either enable or disable depending on the bit status, as
     * specified for the AlarmsEnabled attribute.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.8.7.2.1
     */
    alarmsToEnableDisable: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, BooleanStateConfiguration2.AlarmMode))
  });
  BooleanStateConfiguration2.TlvAlarmsStateChangedEvent = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the state of active alarm modes, as indicated by the AlarmsActive attribute, at the
     * time the event was generated.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.8.8.1.1
     */
    alarmsActive: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, BooleanStateConfiguration2.AlarmMode)),
    /**
     * This field shall indicate the state of suppressed alarm modes, as indicated by the AlarmsSuppressed
     * attribute, at the time the event was generated.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.8.8.1.2
     */
    alarmsSuppressed: (0, import_TlvObject.TlvOptionalField)(1, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, BooleanStateConfiguration2.AlarmMode))
  });
  BooleanStateConfiguration2.TlvSuppressAlarmRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the alarm modes to suppress.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.8.7.1.1
     */
    alarmsToSuppress: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, BooleanStateConfiguration2.AlarmMode))
  });
  BooleanStateConfiguration2.SensorFault = {
    /**
     * Unspecified fault detected
     */
    generalFault: (0, import_BitmapSchema.BitFlag)(0)
  };
  BooleanStateConfiguration2.TlvSensorFaultEvent = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the value of the SensorFault attribute, at the time this event is generated.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.8.8.2.1
     */
    sensorFault: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt16, BooleanStateConfiguration2.SensorFault))
  });
  BooleanStateConfiguration2.SensitivityLevelComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates the currently selected sensitivity level.
       *
       * If a write interaction to this attribute contains an unsupported sensitivity value, a CONSTRAINT_ERROR
       * status shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.6.1
       */
      currentSensitivityLevel: (0, import_Cluster.WritableAttribute)(0, import_TlvNumber.TlvUInt8, { persistent: true }),
      /**
       * Indicates the number of supported sensitivity levels by the device.
       *
       * These supported sensitivity levels shall be ordered by sensitivity, where a value of 0 shall be
       * considered the lowest sensitivity level (least sensitive) and the highest supported value shall be
       * considered the highest sensitivity level.
       *
       * The number of supported sensitivity levels SHOULD represent unique sensitivity levels supported by the
       * device.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.6.2
       */
      supportedSensitivityLevels: (0, import_Cluster.FixedAttribute)(1, import_TlvNumber.TlvUInt8.bound({ min: 2, max: 10 })),
      /**
       * Indicates the default sensitivity level selected by the manufacturer.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.6.3
       */
      defaultSensitivityLevel: (0, import_Cluster.OptionalFixedAttribute)(2, import_TlvNumber.TlvUInt8)
    }
  });
  BooleanStateConfiguration2.VisualOrAudibleComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates which specific alarm modes on the server are currently active. When the sensor is no longer
       * triggered, this attribute shall be set to the inactive state, by setting the bit to 0, for all supported
       * alarm modes.
       *
       * If an alarm mode is not supported, the bit indicating this alarm mode shall always be 0. A bit shall
       * indicate whether the alarm mode inactive or not:
       *
       *   • 0 = Inactive
       *
       *   • 1 = Active
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.6.4
       */
      alarmsActive: (0, import_Cluster.Attribute)(3, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, BooleanStateConfiguration2.AlarmMode)),
      /**
       * Indicates the alarm modes that will be emitted if the sensor is triggered. If an alarm mode is not
       * supported, the bit indicating this alarm mode shall always be 0.
       *
       * A bit shall indicate whether the alarm mode is enabled or disabled:
       *
       *   • 0 = Disabled
       *
       *   • 1 = Enabled
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.6.6
       */
      alarmsEnabled: (0, import_Cluster.OptionalAttribute)(5, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, BooleanStateConfiguration2.AlarmMode), { persistent: true }),
      /**
       * Indicates the alarms supported by the sensor. A bit shall indicate whether the alarm mode is supported:
       *
       *   • 0 = Not supported
       *
       *   • 1 = Supported
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.6.7
       */
      alarmsSupported: (0, import_Cluster.FixedAttribute)(6, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, BooleanStateConfiguration2.AlarmMode))
    },
    commands: {
      /**
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.7.2
       */
      enableDisableAlarm: (0, import_Cluster.Command)(1, BooleanStateConfiguration2.TlvEnableDisableAlarmRequest, 1, import_Cluster.TlvNoResponse)
    },
    events: {
      /**
       * This event shall be generated after any bits in the AlarmsActive and/or AlarmsSuppressed attributes
       * change. This may occur in situations such as when internal processing by the server determines that an
       * alarm mode becomes active or inactive, or when the SuppressAlarm or EnableDisableAlarm commands are
       * processed in a way that some alarm modes becomes suppressed, active or inactive.
       *
       * If several alarm modes change state at the same time, a single event combining multiple changes may be
       * emitted instead of multiple events each representing a single change.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.8.1
       */
      alarmsStateChanged: (0, import_Cluster.Event)(0, import_Priority.Priority.Info, BooleanStateConfiguration2.TlvAlarmsStateChangedEvent)
    }
  });
  BooleanStateConfiguration2.AlarmSuppressComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates which specific alarm modes on the server are currently suppressed. When the sensor is no longer
       * triggered, this attribute shall be set to the unsuppressed state, by setting the bit to 0, for all
       * supported alarm modes.
       *
       * If an alarm mode is not supported, the bit indicating this alarm mode shall always be 0. A bit shall
       * indicate whether the alarm mode is suppressed or not:
       *
       *   • 0 = Not suppressed
       *
       *   • 1 = Suppressed
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.6.5
       */
      alarmsSuppressed: (0, import_Cluster.Attribute)(4, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt8, BooleanStateConfiguration2.AlarmMode))
    },
    commands: {
      /**
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.7.1
       */
      suppressAlarm: (0, import_Cluster.Command)(0, BooleanStateConfiguration2.TlvSuppressAlarmRequest, 0, import_Cluster.TlvNoResponse)
    }
  });
  BooleanStateConfiguration2.Base = import_MutableCluster.MutableCluster.Component({
    id: 128,
    name: "BooleanStateConfiguration",
    revision: 1,
    features: {
      /**
       * Supports visual alarms
       */
      visual: (0, import_BitmapSchema.BitFlag)(0),
      /**
       * Supports audible alarms
       */
      audible: (0, import_BitmapSchema.BitFlag)(1),
      /**
       * This feature shall indicate that the device is able to suppress the supported alarm modes, when the user
       * acknowledges the alarm. This is intended to stop visual and/or audible alarms, when the user has become
       * aware that the sensor is triggered, but it is no longer desired to have the alarm modes active on the
       * device, e.g.:
       *
       *   • The triggering cause have been resolved by the user, but the sensor has not yet stopped detecting the
       *     triggering cause.
       *
       *   • The user is not able to address the triggering cause, but is aware of the alarm and
       *     suppress/acknowledge it be addressed at a later point.
       *
       * Acknowledge of alarms will for the remainder of this cluster be referred to as suppress.
       *
       * A suppressed alarm is still considered active and will remain so unless it is actively disabled or the
       * triggering condition is not longer present. The action of suppressing an alarm mode is only applicable to
       * and is intended to stop the physical alarming, e.g. emitting a sound or blinking a light; it does not
       * impact alarm reporting in AlarmsActive.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.4.1
       */
      alarmSuppress: (0, import_BitmapSchema.BitFlag)(2),
      /**
       * Supports ability to set sensor sensitivity
       */
      sensitivityLevel: (0, import_BitmapSchema.BitFlag)(3)
    },
    attributes: {
      /**
       * Indicates any faults registered by the device.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.6.8
       */
      sensorFault: (0, import_Cluster.OptionalAttribute)(7, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt16, BooleanStateConfiguration2.SensorFault))
    },
    events: {
      /**
       * This event shall be generated when the device registers or clears a fault.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.8.8.2
       */
      sensorFault: (0, import_Cluster.OptionalEvent)(1, import_Priority.Priority.Info, BooleanStateConfiguration2.TlvSensorFaultEvent)
    },
    /**
     * This metadata controls which BooleanStateConfigurationCluster elements matter.js activates for specific
     * feature combinations.
     */
    extensions: import_MutableCluster.MutableCluster.Extensions(
      { flags: { sensitivityLevel: true }, component: BooleanStateConfiguration2.SensitivityLevelComponent },
      { flags: { visual: true }, component: BooleanStateConfiguration2.VisualOrAudibleComponent },
      { flags: { audible: true }, component: BooleanStateConfiguration2.VisualOrAudibleComponent },
      { flags: { alarmSuppress: true }, component: BooleanStateConfiguration2.AlarmSuppressComponent },
      { flags: { alarmSuppress: true, visual: true, audible: true }, component: false }
    )
  });
  BooleanStateConfiguration2.ClusterInstance = (0, import_MutableCluster.MutableCluster)(BooleanStateConfiguration2.Base);
  BooleanStateConfiguration2.Cluster = BooleanStateConfiguration2.ClusterInstance;
  const SENSLVL = { sensitivityLevel: true };
  const VIS = { visual: true };
  const AUD = { audible: true };
  const SPRS = { alarmSuppress: true };
  BooleanStateConfiguration2.CompleteInstance = (0, import_MutableCluster.MutableCluster)({
    id: BooleanStateConfiguration2.Cluster.id,
    name: BooleanStateConfiguration2.Cluster.name,
    revision: BooleanStateConfiguration2.Cluster.revision,
    features: BooleanStateConfiguration2.Cluster.features,
    attributes: {
      ...BooleanStateConfiguration2.Cluster.attributes,
      currentSensitivityLevel: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.SensitivityLevelComponent.attributes.currentSensitivityLevel,
        { mandatoryIf: [SENSLVL] }
      ),
      supportedSensitivityLevels: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.SensitivityLevelComponent.attributes.supportedSensitivityLevels,
        { mandatoryIf: [SENSLVL] }
      ),
      defaultSensitivityLevel: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.SensitivityLevelComponent.attributes.defaultSensitivityLevel,
        { optionalIf: [SENSLVL] }
      ),
      alarmsActive: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.VisualOrAudibleComponent.attributes.alarmsActive,
        { mandatoryIf: [VIS, AUD] }
      ),
      alarmsSuppressed: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.AlarmSuppressComponent.attributes.alarmsSuppressed,
        { mandatoryIf: [SPRS] }
      ),
      alarmsEnabled: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.VisualOrAudibleComponent.attributes.alarmsEnabled,
        { optionalIf: [VIS, AUD] }
      ),
      alarmsSupported: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.VisualOrAudibleComponent.attributes.alarmsSupported,
        { mandatoryIf: [VIS, AUD] }
      )
    },
    commands: {
      suppressAlarm: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.AlarmSuppressComponent.commands.suppressAlarm,
        { mandatoryIf: [SPRS] }
      ),
      enableDisableAlarm: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.VisualOrAudibleComponent.commands.enableDisableAlarm,
        { mandatoryIf: [VIS, AUD] }
      )
    },
    events: {
      ...BooleanStateConfiguration2.Cluster.events,
      alarmsStateChanged: import_MutableCluster.MutableCluster.AsConditional(
        BooleanStateConfiguration2.VisualOrAudibleComponent.events.alarmsStateChanged,
        { mandatoryIf: [VIS, AUD] }
      )
    }
  });
  BooleanStateConfiguration2.Complete = BooleanStateConfiguration2.CompleteInstance;
})(BooleanStateConfiguration || (BooleanStateConfiguration = {}));
const BooleanStateConfigurationCluster = BooleanStateConfiguration.Cluster;
import_ClusterRegistry.ClusterRegistry.register(BooleanStateConfiguration.Complete);
//# sourceMappingURL=boolean-state-configuration.js.map
