"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 AlarmBase_exports = {};
__export(AlarmBase_exports, {
  AlarmBase: () => AlarmBase
});
module.exports = __toCommonJS(AlarmBase_exports);
var import_MatterDefinition = require("../MatterDefinition.js");
var import_elements = require("../../elements/index.js");
/**
 * @license
 * Copyright 2022-2024 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
const AlarmBase = (0, import_elements.ClusterElement)({
  name: "AlarmBase",
  classification: "application",
  pics: "ALARM",
  details: "This cluster is a base cluster from which clusters for particular alarms for a device type can be derived. Each derivation shall define the values for the AlarmBitmap data type used in this cluster. Each derivation shall define which alarms are latched.",
  xref: { document: "cluster", section: "1.15" },
  children: [
    (0, import_elements.AttributeElement)({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 1 }),
    (0, import_elements.AttributeElement)({
      name: "FeatureMap",
      id: 65532,
      type: "FeatureMap",
      xref: { document: "cluster", section: "1.15.4" },
      children: [(0, import_elements.FieldElement)({
        name: "RESET",
        constraint: "0",
        description: "Reset",
        details: "This feature indicates that alarms can be reset via the Reset command.",
        xref: { document: "cluster", section: "1.15.4.1" }
      })]
    }),
    (0, import_elements.AttributeElement)({
      name: "Mask",
      id: 0,
      type: "AlarmBitmap",
      access: "R V",
      conformance: "M",
      default: 0,
      details: "Indicates a bitmap where each bit set in the Mask attribute corresponds to an alarm that shall be enabled.",
      xref: { document: "cluster", section: "1.15.6.1" }
    }),
    (0, import_elements.AttributeElement)({
      name: "Latch",
      id: 1,
      type: "AlarmBitmap",
      access: "R V",
      conformance: "RESET",
      default: 0,
      quality: "F",
      details: "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.",
      xref: { document: "cluster", section: "1.15.6.2" }
    }),
    (0, import_elements.AttributeElement)({
      name: "State",
      id: 2,
      type: "AlarmBitmap",
      access: "R V",
      conformance: "M",
      default: 0,
      details: "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.",
      xref: { document: "cluster", section: "1.15.6.3" }
    }),
    (0, import_elements.AttributeElement)({
      name: "Supported",
      id: 3,
      type: "AlarmBitmap",
      access: "R V",
      conformance: "M",
      default: 0,
      quality: "F",
      details: "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.\nIf an alarm is not supported, the corresponding bit in Mask, Latch, and State shall be false.",
      xref: { document: "cluster", section: "1.15.6.4" }
    }),
    (0, import_elements.EventElement)({
      name: "Notify",
      id: 0,
      access: "V",
      conformance: "M",
      priority: "info",
      details: "This event shall be generated when one or more alarms change state, and shall have these fields:",
      xref: { document: "cluster", section: "1.15.8.1" },
      children: [
        (0, import_elements.FieldElement)({
          name: "Active",
          id: 1,
          type: "AlarmBitmap",
          conformance: "M",
          default: 0,
          details: "This field shall indicate those alarms that have become active.",
          xref: { document: "cluster", section: "1.15.8.1.1" }
        }),
        (0, import_elements.FieldElement)({
          name: "Inactive",
          id: 2,
          type: "AlarmBitmap",
          conformance: "M",
          default: 0,
          details: "This field shall indicate those alarms that have become inactive.",
          xref: { document: "cluster", section: "1.15.8.1.2" }
        }),
        (0, import_elements.FieldElement)({
          name: "State",
          id: 3,
          type: "AlarmBitmap",
          conformance: "M",
          default: 0,
          details: "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.",
          xref: { document: "cluster", section: "1.15.8.1.4" }
        }),
        (0, import_elements.FieldElement)({
          name: "Mask",
          id: 4,
          type: "AlarmBitmap",
          conformance: "M",
          default: 0,
          details: "This field shall be a copy of the Mask attribute when this event was generated.",
          xref: { document: "cluster", section: "1.15.8.1.3" }
        })
      ]
    }),
    (0, import_elements.CommandElement)({
      name: "Reset",
      id: 0,
      access: "O",
      conformance: "RESET",
      direction: "request",
      response: "status",
      details: "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.",
      xref: { document: "cluster", section: "1.15.7.1" },
      children: [(0, import_elements.FieldElement)({
        name: "Alarms",
        id: 0,
        type: "AlarmBitmap",
        conformance: "M",
        default: 0,
        details: "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.",
        xref: { document: "cluster", section: "1.15.7.1.1" }
      })]
    }),
    (0, import_elements.CommandElement)({
      name: "ModifyEnabledAlarms",
      id: 1,
      access: "O",
      conformance: "O",
      direction: "request",
      response: "status",
      details: "This command allows a client to request that an alarm be enabled or suppressed at the server.",
      xref: { document: "cluster", section: "1.15.7.2" },
      children: [(0, import_elements.FieldElement)({
        name: "Mask",
        id: 0,
        type: "AlarmBitmap",
        conformance: "M",
        default: 0,
        details: "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.\nA 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.\nA 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.\nA 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.\nOn a SUCCESS case, the server shall also change the value of the Mask attribute to the value of the\nMask 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.",
        xref: { document: "cluster", section: "1.15.7.2.1" }
      })]
    }),
    (0, import_elements.DatatypeElement)({
      name: "AlarmBitmap",
      type: "map32",
      details: "This data type shall be a map32 with values defined by the derived cluster. The meaning of each bit position shall be consistent for all attributes in a derived cluster. That is, if bit 0 is defined for an alarm, the Latch, State, and Supported information for that alarm are also bit 0.",
      xref: { document: "cluster", section: "1.15.5.1" }
    })
  ]
});
import_MatterDefinition.MatterDefinition.children.push(AlarmBase);
//# sourceMappingURL=AlarmBase.js.map
