/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MatterDefinition } from "../MatterDefinition.js";
import {
  ClusterElement as Cluster,
  AttributeElement as Attribute,
  FieldElement as Field,
  EventElement as Event,
  DatatypeElement as Datatype
} from "../../elements/index.js";
const ElectricalEnergyMeasurement = Cluster(
  { name: "ElectricalEnergyMeasurement", id: 145, classification: "application" },
  Attribute({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 1 }),
  Attribute(
    { name: "FeatureMap", id: 65532, type: "FeatureMap" },
    Field({ name: "IMPE", conformance: "O.a+", constraint: "0", title: "ImportedEnergy" }),
    Field({ name: "EXPE", conformance: "O.a+", constraint: "1", title: "ExportedEnergy" }),
    Field({ name: "CUME", conformance: "O.b+", constraint: "2", title: "CumulativeEnergy" }),
    Field({ name: "PERE", conformance: "O.b+", constraint: "3", title: "PeriodicEnergy" })
  ),
  Attribute(
    { name: "Accuracy", id: 0, type: "MeasurementAccuracyStruct", access: "R V", conformance: "M", quality: "F" }
  ),
  Attribute({
    name: "CumulativeEnergyImported",
    id: 1,
    type: "EnergyMeasurementStruct",
    access: "R V",
    conformance: "IMPE & CUME",
    quality: "X Q"
  }),
  Attribute({
    name: "CumulativeEnergyExported",
    id: 2,
    type: "EnergyMeasurementStruct",
    access: "R V",
    conformance: "EXPE & CUME",
    quality: "X Q"
  }),
  Attribute({
    name: "PeriodicEnergyImported",
    id: 3,
    type: "EnergyMeasurementStruct",
    access: "R V",
    conformance: "IMPE & PERE",
    quality: "X Q"
  }),
  Attribute({
    name: "PeriodicEnergyExported",
    id: 4,
    type: "EnergyMeasurementStruct",
    access: "R V",
    conformance: "EXPE & PERE",
    quality: "X Q"
  }),
  Attribute({
    name: "CumulativeEnergyReset",
    id: 5,
    type: "CumulativeEnergyResetStruct",
    access: "R V",
    conformance: "[CUME]",
    default: null,
    quality: "X"
  }),
  Event(
    { name: "CumulativeEnergyMeasured", id: 0, access: "V", conformance: "CUME", priority: "info" },
    Field({ name: "EnergyImported", id: 0, type: "EnergyMeasurementStruct", conformance: "CUME & IMPE" }),
    Field({ name: "EnergyExported", id: 1, type: "EnergyMeasurementStruct", conformance: "CUME & EXPE" })
  ),
  Event(
    { name: "PeriodicEnergyMeasured", id: 1, access: "V", conformance: "PERE", priority: "info" },
    Field({ name: "EnergyImported", id: 0, type: "EnergyMeasurementStruct", conformance: "PERE & IMPE" }),
    Field({ name: "EnergyExported", id: 1, type: "EnergyMeasurementStruct", conformance: "PERE & EXPE" })
  ),
  Datatype(
    { name: "MeasurementTypeEnum", type: "enum16" },
    Field({ name: "Unspecified", id: 0, conformance: "M" }),
    Field({ name: "Voltage", id: 1, conformance: "M" }),
    Field({ name: "ActiveCurrent", id: 2, conformance: "M" }),
    Field({ name: "ReactiveCurrent", id: 3, conformance: "M" }),
    Field({ name: "ApparentCurrent", id: 4, conformance: "M" }),
    Field({ name: "ActivePower", id: 5, conformance: "M" }),
    Field({ name: "ReactivePower", id: 6, conformance: "M" }),
    Field({ name: "ApparentPower", id: 7, conformance: "M" }),
    Field({ name: "RmsVoltage", id: 8, conformance: "M" }),
    Field({ name: "RmsCurrent", id: 9, conformance: "M" }),
    Field({ name: "RmsPower", id: 10, conformance: "M" }),
    Field({ name: "Frequency", id: 11, conformance: "M" }),
    Field({ name: "PowerFactor", id: 12, conformance: "M" }),
    Field({ name: "NeutralCurrent", id: 13, conformance: "M" }),
    Field({ name: "ElectricalEnergy", id: 14, conformance: "M" }),
    Field({ name: "ReactiveEnergy", id: 15, conformance: "M" }),
    Field({ name: "ApparentEnergy", id: 16, conformance: "M" })
  ),
  Datatype(
    { name: "EnergyMeasurementStruct", type: "struct" },
    Field({ name: "Energy", id: 0, type: "energy-mWh", conformance: "M", constraint: "0 to 2^62" }),
    Field({ name: "StartTimestamp", id: 1, type: "epoch-s", conformance: "desc" }),
    Field({ name: "EndTimestamp", id: 2, type: "epoch-s", conformance: "desc", constraint: "min startTimestamp + 1" }),
    Field({ name: "StartSystime", id: 3, type: "systime-ms", conformance: "desc" }),
    Field({ name: "EndSystime", id: 4, type: "systime-ms", conformance: "desc", constraint: "min startSystime + 1" })
  ),
  Datatype(
    { name: "CumulativeEnergyResetStruct", type: "struct" },
    Field({
      name: "ImportedResetTimestamp",
      id: 0,
      type: "epoch-s",
      conformance: "[IMPE]",
      default: null,
      quality: "X"
    }),
    Field({
      name: "ExportedResetTimestamp",
      id: 1,
      type: "epoch-s",
      conformance: "[EXPE]",
      default: null,
      quality: "X"
    }),
    Field({
      name: "ImportedResetSystime",
      id: 2,
      type: "systime-ms",
      conformance: "[IMPE]",
      default: null,
      quality: "X"
    }),
    Field({
      name: "ExportedResetSystime",
      id: 3,
      type: "systime-ms",
      conformance: "[EXPE]",
      default: null,
      quality: "X"
    })
  )
);
MatterDefinition.children.push(ElectricalEnergyMeasurement);
export {
  ElectricalEnergyMeasurement
};
//# sourceMappingURL=electrical-energy-measurement.element.js.map
