"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 concentration_measurement_exports = {};
__export(concentration_measurement_exports, {
  ConcentrationMeasurement: () => ConcentrationMeasurement
});
module.exports = __toCommonJS(concentration_measurement_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_TlvNullable = require("../tlv/TlvNullable.js");
var import_BitmapSchema = require("../schema/BitmapSchema.js");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var ConcentrationMeasurement;
((ConcentrationMeasurement2) => {
  let Feature;
  ((Feature2) => {
    Feature2["NumericMeasurement"] = "NumericMeasurement";
    Feature2["LevelIndication"] = "LevelIndication";
    Feature2["MediumLevel"] = "MediumLevel";
    Feature2["CriticalLevel"] = "CriticalLevel";
    Feature2["PeakMeasurement"] = "PeakMeasurement";
    Feature2["AverageMeasurement"] = "AverageMeasurement";
  })(Feature = ConcentrationMeasurement2.Feature || (ConcentrationMeasurement2.Feature = {}));
  let MeasurementUnit;
  ((MeasurementUnit2) => {
    MeasurementUnit2[MeasurementUnit2["Ppm"] = 0] = "Ppm";
    MeasurementUnit2[MeasurementUnit2["Ppb"] = 1] = "Ppb";
    MeasurementUnit2[MeasurementUnit2["Ppt"] = 2] = "Ppt";
    MeasurementUnit2[MeasurementUnit2["Mgm3"] = 3] = "Mgm3";
    MeasurementUnit2[MeasurementUnit2["Ugm3"] = 4] = "Ugm3";
    MeasurementUnit2[MeasurementUnit2["Ngm3"] = 5] = "Ngm3";
    MeasurementUnit2[MeasurementUnit2["Pm3"] = 6] = "Pm3";
    MeasurementUnit2[MeasurementUnit2["Bqm3"] = 7] = "Bqm3";
  })(MeasurementUnit = ConcentrationMeasurement2.MeasurementUnit || (ConcentrationMeasurement2.MeasurementUnit = {}));
  let LevelValue;
  ((LevelValue2) => {
    LevelValue2[LevelValue2["Unknown"] = 0] = "Unknown";
    LevelValue2[LevelValue2["Low"] = 1] = "Low";
    LevelValue2[LevelValue2["Medium"] = 2] = "Medium";
    LevelValue2[LevelValue2["High"] = 3] = "High";
    LevelValue2[LevelValue2["Critical"] = 4] = "Critical";
  })(LevelValue = ConcentrationMeasurement2.LevelValue || (ConcentrationMeasurement2.LevelValue = {}));
  let MeasurementMedium;
  ((MeasurementMedium2) => {
    MeasurementMedium2[MeasurementMedium2["Air"] = 0] = "Air";
    MeasurementMedium2[MeasurementMedium2["Water"] = 1] = "Water";
    MeasurementMedium2[MeasurementMedium2["Soil"] = 2] = "Soil";
  })(MeasurementMedium = ConcentrationMeasurement2.MeasurementMedium || (ConcentrationMeasurement2.MeasurementMedium = {}));
  ConcentrationMeasurement2.NumericMeasurementComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates the most recent measurement as a single-precision floating-point number. MeasuredValue’s unit
       * is represented by MeasurementUnit.
       *
       * A value of null indicates that the measurement is unknown or outside the valid range. MinMeasuredValue
       * and MaxMeasuredValue define the valid range for MeasuredValue.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.1
       */
      measuredValue: (0, import_Cluster.Attribute)(0, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvFloat), { default: null }),
      /**
       * Indicates the minimum value of MeasuredValue that is capable of being measured. A MinMeasuredValue of
       * null indicates that the MinMeasuredValue is not defined.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.2
       */
      minMeasuredValue: (0, import_Cluster.Attribute)(1, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvFloat), { default: null }),
      /**
       * Indicates the maximum value of MeasuredValue that is capable of being measured. A MaxMeasuredValue of
       * null indicates that the MaxMeasuredValue is not defined.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.3
       */
      maxMeasuredValue: (0, import_Cluster.Attribute)(2, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvFloat), { default: null }),
      /**
       * Indicates the range of error or deviation that can be found in MeasuredValue and PeakMeasuredValue. This
       * is considered a +/- value and should be considered to be in MeasurementUnit.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.8
       */
      uncertainty: (0, import_Cluster.OptionalAttribute)(7, import_TlvNumber.TlvFloat),
      /**
       * Indicates the unit of MeasuredValue. See MeasurementUnitEnum.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.9
       */
      measurementUnit: (0, import_Cluster.FixedAttribute)(8, (0, import_TlvNumber.TlvEnum)())
    }
  });
  ConcentrationMeasurement2.PeakMeasurementComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates the maximum value of MeasuredValue that has been measured during the PeakMeasuredValueWindow.
       * If this attribute is provided, the PeakMeasuredValueWindow attribute shall also be provided.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.4
       */
      peakMeasuredValue: (0, import_Cluster.Attribute)(3, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvFloat), { default: null }),
      /**
       * Indicates the window of time used for determining the PeakMeasuredValue. The value is in seconds.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.5
       */
      peakMeasuredValueWindow: (0, import_Cluster.Attribute)(4, import_TlvNumber.TlvUInt32.bound({ max: 604800 }), { default: 1 })
    }
  });
  ConcentrationMeasurement2.AverageMeasurementComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates the average value of MeasuredValue that has been measured during the
       * AverageMeasuredValueWindow. If this attribute is provided, the AverageMeasuredValueWindow attribute
       * shall also be provided.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.6
       */
      averageMeasuredValue: (0, import_Cluster.Attribute)(5, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvFloat), { default: null }),
      /**
       * Indicates the window of time used for determining the AverageMeasuredValue. The value is in seconds.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.7
       */
      averageMeasuredValueWindow: (0, import_Cluster.Attribute)(6, import_TlvNumber.TlvUInt32.bound({ max: 604800 }), { default: 1 })
    }
  });
  ConcentrationMeasurement2.LevelIndicationComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates the level of the substance detected. See LevelValueEnum.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.11
       */
      levelValue: (0, import_Cluster.Attribute)(10, (0, import_TlvNumber.TlvEnum)(), { default: 0 /* Unknown */ })
    }
  });
  ConcentrationMeasurement2.Base = import_MutableCluster.MutableCluster.Component({
    features: {
      /**
       * NumericMeasurement
       *
       * Cluster supports numeric measurement of substance
       */
      numericMeasurement: (0, import_BitmapSchema.BitFlag)(0),
      /**
       * LevelIndication
       *
       * Cluster supports basic level indication for substance using the ConcentrationLevel enum
       */
      levelIndication: (0, import_BitmapSchema.BitFlag)(1),
      /**
       * MediumLevel
       *
       * Cluster supports the Medium Concentration Level
       */
      mediumLevel: (0, import_BitmapSchema.BitFlag)(2),
      /**
       * CriticalLevel
       *
       * Cluster supports the Critical Concentration Level
       */
      criticalLevel: (0, import_BitmapSchema.BitFlag)(3),
      /**
       * PeakMeasurement
       *
       * Cluster supports peak numeric measurement of substance
       */
      peakMeasurement: (0, import_BitmapSchema.BitFlag)(4),
      /**
       * AverageMeasurement
       *
       * Cluster supports average numeric measurement of substance
       */
      averageMeasurement: (0, import_BitmapSchema.BitFlag)(5)
    },
    name: "ConcentrationMeasurement",
    revision: 3,
    attributes: {
      /**
       * Indicates the medium in which MeasuredValue is being measured. See MeasurementMediumEnum.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 2.10.6.10
       */
      measurementMedium: (0, import_Cluster.FixedAttribute)(9, (0, import_TlvNumber.TlvEnum)())
    },
    /**
     * This metadata controls which ConcentrationMeasurementCluster elements matter.js activates for specific
     * feature combinations.
     */
    extensions: import_MutableCluster.MutableCluster.Extensions(
      { flags: { numericMeasurement: true }, component: ConcentrationMeasurement2.NumericMeasurementComponent },
      { flags: { peakMeasurement: true }, component: ConcentrationMeasurement2.PeakMeasurementComponent },
      { flags: { averageMeasurement: true }, component: ConcentrationMeasurement2.AverageMeasurementComponent },
      { flags: { levelIndication: true }, component: ConcentrationMeasurement2.LevelIndicationComponent },
      { flags: { mediumLevel: true, levelIndication: false }, component: false },
      { flags: { criticalLevel: true, levelIndication: false }, component: false },
      { flags: { peakMeasurement: true, numericMeasurement: false }, component: false },
      { flags: { averageMeasurement: true, numericMeasurement: false }, component: false },
      { flags: { numericMeasurement: false, levelIndication: false }, component: false }
    )
  });
  const MEA = { numericMeasurement: true };
  const PEA = { peakMeasurement: true };
  const AVG = { averageMeasurement: true };
  const LEV = { levelIndication: true };
  ConcentrationMeasurement2.CompleteInstance = import_MutableCluster.MutableCluster.Component({
    name: ConcentrationMeasurement2.Base.name,
    revision: ConcentrationMeasurement2.Base.revision,
    features: ConcentrationMeasurement2.Base.features,
    attributes: {
      ...ConcentrationMeasurement2.Base.attributes,
      measuredValue: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.NumericMeasurementComponent.attributes.measuredValue,
        { mandatoryIf: [MEA] }
      ),
      minMeasuredValue: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.NumericMeasurementComponent.attributes.minMeasuredValue,
        { mandatoryIf: [MEA] }
      ),
      maxMeasuredValue: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.NumericMeasurementComponent.attributes.maxMeasuredValue,
        { mandatoryIf: [MEA] }
      ),
      peakMeasuredValue: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.PeakMeasurementComponent.attributes.peakMeasuredValue,
        { mandatoryIf: [PEA] }
      ),
      peakMeasuredValueWindow: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.PeakMeasurementComponent.attributes.peakMeasuredValueWindow,
        { mandatoryIf: [PEA] }
      ),
      averageMeasuredValue: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.AverageMeasurementComponent.attributes.averageMeasuredValue,
        { mandatoryIf: [AVG] }
      ),
      averageMeasuredValueWindow: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.AverageMeasurementComponent.attributes.averageMeasuredValueWindow,
        { mandatoryIf: [AVG] }
      ),
      uncertainty: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.NumericMeasurementComponent.attributes.uncertainty,
        { optionalIf: [MEA] }
      ),
      measurementUnit: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.NumericMeasurementComponent.attributes.measurementUnit,
        { mandatoryIf: [MEA] }
      ),
      levelValue: import_MutableCluster.MutableCluster.AsConditional(
        ConcentrationMeasurement2.LevelIndicationComponent.attributes.levelValue,
        { mandatoryIf: [LEV] }
      )
    }
  });
  ConcentrationMeasurement2.Complete = ConcentrationMeasurement2.CompleteInstance;
})(ConcentrationMeasurement || (ConcentrationMeasurement = {}));
//# sourceMappingURL=concentration-measurement.js.map
