/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MutableCluster } from "../cluster/mutation/MutableCluster.js";
import { Attribute, OptionalAttribute } from "../cluster/Cluster.js";
import { TlvUInt16, TlvUInt8 } from "../tlv/TlvNumber.js";
import { TlvNullable } from "../tlv/TlvNullable.js";
import { ClusterRegistry } from "../cluster/ClusterRegistry.js";
var IlluminanceMeasurement;
((IlluminanceMeasurement2) => {
  let LightSensorType;
  ((LightSensorType2) => {
    LightSensorType2[LightSensorType2["Photodiode"] = 0] = "Photodiode";
    LightSensorType2[LightSensorType2["Cmos"] = 1] = "Cmos";
  })(LightSensorType = IlluminanceMeasurement2.LightSensorType || (IlluminanceMeasurement2.LightSensorType = {}));
  IlluminanceMeasurement2.ClusterInstance = MutableCluster({
    id: 1024,
    name: "IlluminanceMeasurement",
    revision: 3,
    attributes: {
      /**
       * Indicates the illuminance in Lux (symbol lx) as follows:
       *
       *   - MeasuredValue = 10,000 x log10(illuminance) + 1,
       *
       * where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
       *
       * The MeasuredValue attribute can take the following values:
       *
       *   - 0 indicates a value of illuminance that is too low to be measured,
       *
       *   - MinMeasuredValue <= MeasuredValue <= MaxMeasuredValue under normal circumstances,
       *
       *   - null indicates that the illuminance measurement is invalid.
       *
       * The MeasuredValue attribute is updated continuously as new measurements are made.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.2.5.1
       */
      measuredValue: Attribute(0, TlvNullable(TlvUInt16)),
      /**
       * Indicates the minimum value of MeasuredValue that can be measured. A value of null indicates that this
       * attribute is not defined. See Measured Value for more details.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.2.5.2
       */
      minMeasuredValue: Attribute(1, TlvNullable(TlvUInt16.bound({ min: 1, max: 65533 }))),
      /**
       * Indicates the maximum value of MeasuredValue that can be measured. A value of null indicates that this
       * attribute is not defined. See Measured Value for more details.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.2.5.3
       */
      maxMeasuredValue: Attribute(2, TlvNullable(TlvUInt16)),
      /**
       * See Measured Value.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.2.5.4
       */
      tolerance: OptionalAttribute(3, TlvUInt16.bound({ max: 2048 })),
      /**
       * Indicates the electronic type of the light sensor. This attribute shall be set to one of the non-reserved
       * values listed in LightSensorTypeEnum or null in case the sensor type is unknown.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.2.5.5
       */
      lightSensorType: OptionalAttribute(4, TlvNullable(TlvUInt8), { default: null })
    }
  });
  IlluminanceMeasurement2.Cluster = IlluminanceMeasurement2.ClusterInstance;
  IlluminanceMeasurement2.Complete = IlluminanceMeasurement2.Cluster;
})(IlluminanceMeasurement || (IlluminanceMeasurement = {}));
const IlluminanceMeasurementCluster = IlluminanceMeasurement.Cluster;
ClusterRegistry.register(IlluminanceMeasurement.Complete);
export {
  IlluminanceMeasurement,
  IlluminanceMeasurementCluster
};
//# sourceMappingURL=illuminance-measurement.js.map
