"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 dishwasher_alarm_exports = {};
__export(dishwasher_alarm_exports, {
  DishwasherAlarm: () => DishwasherAlarm,
  DishwasherAlarmCluster: () => DishwasherAlarmCluster
});
module.exports = __toCommonJS(dishwasher_alarm_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_TlvObject = require("../tlv/TlvObject.js");
var import_Priority = require("../globals/Priority.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var DishwasherAlarm;
((DishwasherAlarm2) => {
  let Feature;
  ((Feature2) => {
    Feature2["Reset"] = "Reset";
  })(Feature = DishwasherAlarm2.Feature || (DishwasherAlarm2.Feature = {}));
  DishwasherAlarm2.Alarm = {
    /**
     * Water inflow is abnormal
     */
    inflowError: (0, import_BitmapSchema.BitFlag)(0),
    /**
     * Water draining is abnormal
     */
    drainError: (0, import_BitmapSchema.BitFlag)(1),
    /**
     * Door or door lock is abnormal
     */
    doorError: (0, import_BitmapSchema.BitFlag)(2),
    /**
     * Unable to reach normal temperature
     */
    tempTooLow: (0, import_BitmapSchema.BitFlag)(3),
    /**
     * Temperature is too high
     */
    tempTooHigh: (0, import_BitmapSchema.BitFlag)(4),
    /**
     * Water level is abnormal
     */
    waterLevelError: (0, import_BitmapSchema.BitFlag)(5)
  };
  DishwasherAlarm2.TlvResetRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate a bitmap where each bit set in this field corresponds to an alarm that shall be
     * reset to inactive in the State attribute unless the alarm definition requires manual intervention. If the
     * alarms indicated are successfully reset, the response status code shall be SUCCESS, otherwise, the response
     * status code shall be FAILURE.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.15.7.1.1
     */
    alarms: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm))
  });
  DishwasherAlarm2.TlvModifyEnabledAlarmsRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate a bitmap where each bit set in the this field corresponds to an alarm that SHOULD
     * be enabled or suppressed. A value of 1 shall indicate that the alarm SHOULD be enabled while a value of 0
     * shall indicate that the alarm SHOULD be suppressed.
     *
     * A server that receives this command with a Mask that includes bits that are set for unknown alarms shall
     * respond with a status code of INVALID_COMMAND.
     *
     * A server that receives this command with a Mask that includes bits that are set for alarms which are not
     * supported, as indicated in the Supported attribute, shall respond with a status code of INVALID_COMMAND.
     *
     * A server that is unable to enable a currently suppressed alarm, or is unable to suppress a currently enabled
     * alarm shall respond with a status code of FAILURE; otherwise the server shall respond with a status code of
     * SUCCESS.
     *
     * On a SUCCESS case, the server shall also change the value of the Mask attribute to the value of the Mask
     * field from this command. After that the server shall also update the value of its State attribute to reflect
     * the status of the new alarm set as indicated by the new value of the Mask attribute.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.15.7.2.1
     */
    mask: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm))
  });
  DishwasherAlarm2.TlvNotifyEvent = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate those alarms that have become active.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.15.8.1.1
     */
    active: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm)),
    /**
     * This field shall indicate those alarms that have become inactive.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.15.8.1.2
     */
    inactive: (0, import_TlvObject.TlvField)(1, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm)),
    /**
     * This field shall be a copy of the new State attribute value that resulted in the event being generated. That
     * is, this field shall have all the bits in Active set and shall NOT have any of the bits in Inactive set.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.15.8.1.4
     */
    state: (0, import_TlvObject.TlvField)(2, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm)),
    /**
     * This field shall be a copy of the Mask attribute when this event was generated.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.15.8.1.3
     */
    mask: (0, import_TlvObject.TlvField)(3, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm))
  });
  DishwasherAlarm2.ResetComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates a bitmap where each bit set in the Latch attribute shall indicate that the corresponding alarm
       * will be latched when set, and will not reset to inactive when the underlying condition which caused the
       * alarm is no longer present, and so requires an explicit reset using the Reset command.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.15.6.2
       */
      latch: (0, import_Cluster.FixedAttribute)(1, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm))
    },
    commands: {
      /**
       * This command resets active and latched alarms (if possible). Any generated Notify event shall contain
       * fields that represent the state of the server after the command has been processed.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.15.7.1
       */
      reset: (0, import_Cluster.Command)(0, DishwasherAlarm2.TlvResetRequest, 0, import_Cluster.TlvNoResponse)
    }
  });
  DishwasherAlarm2.Base = import_MutableCluster.MutableCluster.Component({
    id: 93,
    name: "DishwasherAlarm",
    revision: 1,
    features: {
      /**
       * This feature indicates that alarms can be reset via the Reset command.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.15.4.1
       */
      reset: (0, import_BitmapSchema.BitFlag)(0)
    },
    attributes: {
      /**
       * Indicates a bitmap where each bit set in the Mask attribute corresponds to an alarm that shall be
       * enabled.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.15.6.1
       */
      mask: (0, import_Cluster.Attribute)(0, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm)),
      /**
       * Indicates a bitmap where each bit shall represent the state of an alarm. The value of true means the
       * alarm is active, otherwise the alarm is inactive.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.15.6.3
       */
      state: (0, import_Cluster.Attribute)(2, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm)),
      /**
       * Indicates a bitmap where each bit shall represent whether or not an alarm is supported. The value of true
       * means the alarm is supported, otherwise the alarm is not supported.
       *
       * If an alarm is not supported, the corresponding bit in Mask, Latch, and State shall be false.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.15.6.4
       */
      supported: (0, import_Cluster.FixedAttribute)(3, (0, import_TlvNumber.TlvBitmap)(import_TlvNumber.TlvUInt32, DishwasherAlarm2.Alarm))
    },
    commands: {
      /**
       * This command allows a client to request that an alarm be enabled or suppressed at the server.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.15.7.2
       */
      modifyEnabledAlarms: (0, import_Cluster.OptionalCommand)(1, DishwasherAlarm2.TlvModifyEnabledAlarmsRequest, 1, import_Cluster.TlvNoResponse)
    },
    events: {
      /**
       * This event shall be generated when one or more alarms change state.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.15.8.1
       */
      notify: (0, import_Cluster.Event)(0, import_Priority.Priority.Info, DishwasherAlarm2.TlvNotifyEvent)
    },
    /**
     * This metadata controls which DishwasherAlarmCluster elements matter.js activates for specific feature
     * combinations.
     */
    extensions: import_MutableCluster.MutableCluster.Extensions({ flags: { reset: true }, component: DishwasherAlarm2.ResetComponent })
  });
  DishwasherAlarm2.ClusterInstance = (0, import_MutableCluster.MutableCluster)(DishwasherAlarm2.Base);
  DishwasherAlarm2.Cluster = DishwasherAlarm2.ClusterInstance;
  const RESET = { reset: true };
  DishwasherAlarm2.CompleteInstance = (0, import_MutableCluster.MutableCluster)({
    id: DishwasherAlarm2.Cluster.id,
    name: DishwasherAlarm2.Cluster.name,
    revision: DishwasherAlarm2.Cluster.revision,
    features: DishwasherAlarm2.Cluster.features,
    attributes: {
      ...DishwasherAlarm2.Cluster.attributes,
      latch: import_MutableCluster.MutableCluster.AsConditional(DishwasherAlarm2.ResetComponent.attributes.latch, { mandatoryIf: [RESET] })
    },
    commands: {
      ...DishwasherAlarm2.Cluster.commands,
      reset: import_MutableCluster.MutableCluster.AsConditional(DishwasherAlarm2.ResetComponent.commands.reset, { mandatoryIf: [RESET] })
    },
    events: DishwasherAlarm2.Cluster.events
  });
  DishwasherAlarm2.Complete = DishwasherAlarm2.CompleteInstance;
})(DishwasherAlarm || (DishwasherAlarm = {}));
const DishwasherAlarmCluster = DishwasherAlarm.Cluster;
import_ClusterRegistry.ClusterRegistry.register(DishwasherAlarm.Complete);
//# sourceMappingURL=dishwasher-alarm.js.map
