/**
 * @license
 * Copyright 2022-2025 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,
  CommandElement as Command,
  DatatypeElement as Datatype
} from "../../elements/index.js";
const DeviceEnergyManagement = Cluster(
  { name: "DeviceEnergyManagement", id: 152, classification: "application" },
  Attribute({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 4 }),
  Attribute(
    { name: "FeatureMap", id: 65532, type: "FeatureMap" },
    Field({ name: "PA", conformance: "O", constraint: "0", title: "PowerAdjustment" }),
    Field({
      name: "PFR",
      conformance: "[!PA].a, STA | PAU | FA | CON, O",
      constraint: "1",
      title: "PowerForecastReporting"
    }),
    Field({ name: "SFR", conformance: "[!PA].a", constraint: "2", title: "StateForecastReporting" }),
    Field({ name: "STA", conformance: "O", constraint: "3", title: "StartTimeAdjustment" }),
    Field({ name: "PAU", conformance: "O", constraint: "4", title: "Pausable" }),
    Field({ name: "FA", conformance: "O", constraint: "5", title: "ForecastAdjustment" }),
    Field({ name: "CON", conformance: "O", constraint: "6", title: "ConstraintBasedAdjustment" })
  ),
  Attribute({ name: "EsaType", id: 0, type: "ESATypeEnum", access: "R V", conformance: "M", quality: "F" }),
  Attribute({ name: "EsaCanGenerate", id: 1, type: "bool", access: "R V", conformance: "M", quality: "F" }),
  Attribute({ name: "EsaState", id: 2, type: "ESAStateEnum", access: "R V", conformance: "M", constraint: "desc" }),
  Attribute({ name: "AbsMinPower", id: 3, type: "power-mW", access: "R V", conformance: "M" }),
  Attribute({ name: "AbsMaxPower", id: 4, type: "power-mW", access: "R V", conformance: "M", constraint: "min absMinPower" }),
  Attribute({
    name: "PowerAdjustmentCapability",
    id: 5,
    type: "PowerAdjustCapabilityStruct",
    access: "R V",
    conformance: "PA",
    quality: "X Q"
  }),
  Attribute(
    { name: "Forecast", id: 6, type: "ForecastStruct", access: "R V", conformance: "PFR | SFR", quality: "X Q" }
  ),
  Attribute({
    name: "OptOutState",
    id: 7,
    type: "OptOutStateEnum",
    access: "R V",
    conformance: "PA | STA | PAU | FA | CON",
    constraint: "desc"
  }),
  Event({ name: "PowerAdjustStart", id: 0, access: "V", conformance: "PA", priority: "info" }),
  Event(
    { name: "PowerAdjustEnd", id: 1, access: "V", conformance: "PA", priority: "info" },
    Field({ name: "Cause", id: 0, type: "CauseEnum", conformance: "M" }),
    Field({ name: "Duration", id: 1, type: "elapsed-s", conformance: "M" }),
    Field({ name: "EnergyUse", id: 2, type: "energy-mWh", conformance: "M" })
  ),
  Event({ name: "Paused", id: 2, access: "V", conformance: "PAU", priority: "info" }),
  Event(
    { name: "Resumed", id: 3, access: "V", conformance: "PAU", priority: "info" },
    Field({ name: "Cause", id: 0, type: "CauseEnum", conformance: "M" })
  ),
  Command(
    {
      name: "PowerAdjustRequest",
      id: 0,
      access: "O",
      conformance: "PA",
      direction: "request",
      response: "status"
    },
    Field({ name: "Power", id: 0, type: "power-mW", conformance: "M", constraint: "desc" }),
    Field({ name: "Duration", id: 1, type: "elapsed-s", conformance: "M", constraint: "desc" }),
    Field({ name: "Cause", id: 2, type: "AdjustmentCauseEnum", conformance: "M", constraint: "desc" })
  ),
  Command({
    name: "CancelPowerAdjustRequest",
    id: 1,
    access: "O",
    conformance: "PA",
    direction: "request",
    response: "status"
  }),
  Command(
    {
      name: "StartTimeAdjustRequest",
      id: 2,
      access: "O",
      conformance: "STA",
      direction: "request",
      response: "status"
    },
    Field({ name: "RequestedStartTime", id: 0, type: "epoch-s", conformance: "M", constraint: "desc" }),
    Field({ name: "Cause", id: 1, type: "AdjustmentCauseEnum", conformance: "M" })
  ),
  Command(
    { name: "PauseRequest", id: 3, access: "O", conformance: "PAU", direction: "request", response: "status" },
    Field({ name: "Duration", id: 0, type: "elapsed-s", conformance: "M", constraint: "desc" }),
    Field({ name: "Cause", id: 1, type: "AdjustmentCauseEnum", conformance: "M" })
  ),
  Command({ name: "ResumeRequest", id: 4, access: "O", conformance: "PAU", direction: "request", response: "status" }),
  Command(
    {
      name: "ModifyForecastRequest",
      id: 5,
      access: "O",
      conformance: "FA",
      direction: "request",
      response: "status"
    },
    Field({ name: "ForecastId", id: 0, type: "uint32", conformance: "M" }),
    Field(
      { name: "SlotAdjustments", id: 1, type: "list", conformance: "M", constraint: "max 10" },
      Field({ name: "entry", type: "SlotAdjustmentStruct" })
    ),
    Field({ name: "Cause", id: 2, type: "AdjustmentCauseEnum", conformance: "M" })
  ),
  Command(
    {
      name: "RequestConstraintBasedForecast",
      id: 6,
      access: "O",
      conformance: "CON",
      direction: "request",
      response: "status"
    },
    Field(
      { name: "Constraints", id: 0, type: "list", conformance: "M", constraint: "max 10" },
      Field({ name: "entry", type: "ConstraintsStruct" })
    ),
    Field({ name: "Cause", id: 1, type: "AdjustmentCauseEnum", conformance: "M" })
  ),
  Command({
    name: "CancelRequest",
    id: 7,
    access: "O",
    conformance: "STA | FA | CON",
    direction: "request",
    response: "status"
  }),
  Datatype(
    { name: "CostTypeEnum", type: "enum8" },
    Field({ name: "Financial", id: 0, conformance: "M" }),
    Field({ name: "GhgEmissions", id: 1, conformance: "M" }),
    Field({ name: "Comfort", id: 2, conformance: "M" }),
    Field({ name: "Temperature", id: 3, conformance: "M" })
  ),
  Datatype(
    { name: "ESATypeEnum", type: "enum8" },
    Field({ name: "Evse", id: 0, conformance: "O" }),
    Field({ name: "SpaceHeating", id: 1, conformance: "O" }),
    Field({ name: "WaterHeating", id: 2, conformance: "O" }),
    Field({ name: "SpaceCooling", id: 3, conformance: "O" }),
    Field({ name: "SpaceHeatingCooling", id: 4, conformance: "O" }),
    Field({ name: "BatteryStorage", id: 5, conformance: "O" }),
    Field({ name: "SolarPv", id: 6, conformance: "O" }),
    Field({ name: "FridgeFreezer", id: 7, conformance: "O" }),
    Field({ name: "WashingMachine", id: 8, conformance: "O" }),
    Field({ name: "Dishwasher", id: 9, conformance: "O" }),
    Field({ name: "Cooking", id: 10, conformance: "O" }),
    Field({ name: "HomeWaterPump", id: 11, conformance: "O" }),
    Field({ name: "IrrigationWaterPump", id: 12, conformance: "O" }),
    Field({ name: "PoolPump", id: 13, conformance: "O" }),
    Field({ name: "Other", id: 255, conformance: "O" })
  ),
  Datatype(
    { name: "ESAStateEnum", type: "enum8" },
    Field({ name: "Offline", id: 0, conformance: "M" }),
    Field({ name: "Online", id: 1, conformance: "M" }),
    Field({ name: "Fault", id: 2, conformance: "M" }),
    Field({ name: "PowerAdjustActive", id: 3, conformance: "PA" }),
    Field({ name: "Paused", id: 4, conformance: "PAU" })
  ),
  Datatype(
    { name: "OptOutStateEnum", type: "enum8" },
    Field({ name: "NoOptOut", id: 0, conformance: "M" }),
    Field({ name: "LocalOptOut", id: 1, conformance: "M" }),
    Field({ name: "GridOptOut", id: 2, conformance: "M" }),
    Field({ name: "OptOut", id: 3, conformance: "M" })
  ),
  Datatype(
    { name: "CauseEnum", type: "enum8" },
    Field({ name: "NormalCompletion", id: 0, conformance: "M" }),
    Field({ name: "Offline", id: 1, conformance: "M" }),
    Field({ name: "Fault", id: 2, conformance: "M" }),
    Field({ name: "UserOptOut", id: 3, conformance: "M" }),
    Field({ name: "Cancelled", id: 4, conformance: "M" })
  ),
  Datatype(
    { name: "AdjustmentCauseEnum", type: "enum8" },
    Field({ name: "LocalOptimization", id: 0, conformance: "M" }),
    Field({ name: "GridOptimization", id: 1, conformance: "M" })
  ),
  Datatype(
    { name: "ForecastUpdateReasonEnum", type: "enum8" },
    Field({ name: "InternalOptimization", id: 0, conformance: "M" }),
    Field({ name: "LocalOptimization", id: 1, conformance: "M" }),
    Field({ name: "GridOptimization", id: 2, conformance: "M" })
  ),
  Datatype(
    { name: "PowerAdjustReasonEnum", type: "enum8" },
    Field({ name: "NoAdjustment", id: 0, conformance: "M" }),
    Field({ name: "LocalOptimizationAdjustment", id: 1, conformance: "M" }),
    Field({ name: "GridOptimizationAdjustment", id: 2, conformance: "M" })
  ),
  Datatype(
    { name: "CostStruct", type: "struct" },
    Field({ name: "CostType", id: 0, type: "CostTypeEnum", conformance: "M" }),
    Field({ name: "Value", id: 1, type: "int32", conformance: "M" }),
    Field({ name: "DecimalPoints", id: 2, type: "uint8", conformance: "M" }),
    Field({ name: "Currency", id: 3, type: "uint16", conformance: "O", constraint: "max 999", default: 0 })
  ),
  Datatype(
    { name: "PowerAdjustStruct", type: "struct" },
    Field({ name: "MinPower", id: 0, type: "power-mW", conformance: "M" }),
    Field({ name: "MaxPower", id: 1, type: "power-mW", conformance: "M", constraint: "min minPower" }),
    Field({ name: "MinDuration", id: 2, type: "elapsed-s", conformance: "M" }),
    Field({ name: "MaxDuration", id: 3, type: "elapsed-s", conformance: "M", constraint: "min minDuration" })
  ),
  Datatype(
    { name: "PowerAdjustCapabilityStruct", type: "struct" },
    Field(
      {
        name: "PowerAdjustCapability",
        id: 0,
        type: "list",
        conformance: "M",
        constraint: "max 8",
        quality: "X"
      },
      Field({ name: "entry", type: "PowerAdjustStruct" })
    ),
    Field({ name: "Cause", id: 1, type: "PowerAdjustReasonEnum", conformance: "M" })
  ),
  Datatype(
    { name: "ForecastStruct", type: "struct" },
    Field({ name: "ForecastId", id: 0, type: "uint32", conformance: "M" }),
    Field({ name: "ActiveSlotNumber", id: 1, type: "uint16", conformance: "M", quality: "X" }),
    Field({ name: "StartTime", id: 2, type: "epoch-s", conformance: "M" }),
    Field({ name: "EndTime", id: 3, type: "epoch-s", conformance: "M" }),
    Field({ name: "EarliestStartTime", id: 4, type: "epoch-s", conformance: "STA", quality: "X" }),
    Field({ name: "LatestEndTime", id: 5, type: "epoch-s", conformance: "STA" }),
    Field({ name: "IsPausable", id: 6, type: "bool", conformance: "M" }),
    Field(
      { name: "Slots", id: 7, type: "list", conformance: "M", constraint: "max 10" },
      Field({ name: "entry", type: "SlotStruct" })
    ),
    Field({ name: "ForecastUpdateReason", id: 8, type: "ForecastUpdateReasonEnum", conformance: "M" })
  ),
  Datatype(
    { name: "SlotStruct", type: "struct" },
    Field({ name: "MinDuration", id: 0, type: "elapsed-s", conformance: "M" }),
    Field({ name: "MaxDuration", id: 1, type: "elapsed-s", conformance: "M" }),
    Field({ name: "DefaultDuration", id: 2, type: "elapsed-s", conformance: "M" }),
    Field({ name: "ElapsedSlotTime", id: 3, type: "elapsed-s", conformance: "M" }),
    Field({ name: "RemainingSlotTime", id: 4, type: "elapsed-s", conformance: "M" }),
    Field({ name: "SlotIsPausable", id: 5, type: "bool", conformance: "PAU" }),
    Field({ name: "MinPauseDuration", id: 6, type: "elapsed-s", conformance: "PAU" }),
    Field({ name: "MaxPauseDuration", id: 7, type: "elapsed-s", conformance: "PAU" }),
    Field({ name: "ManufacturerEsaState", id: 8, type: "uint16", conformance: "SFR" }),
    Field({ name: "NominalPower", id: 9, type: "power-mW", conformance: "PFR" }),
    Field({ name: "MinPower", id: 10, type: "power-mW", conformance: "PFR" }),
    Field({ name: "MaxPower", id: 11, type: "power-mW", conformance: "PFR" }),
    Field({ name: "NominalEnergy", id: 12, type: "energy-mWh", conformance: "PFR" }),
    Field(
      { name: "Costs", id: 13, type: "list", conformance: "O", constraint: "max 5" },
      Field({ name: "entry", type: "CostStruct" })
    ),
    Field({ name: "MinPowerAdjustment", id: 14, type: "power-mW", conformance: "FA & PFR" }),
    Field({ name: "MaxPowerAdjustment", id: 15, type: "power-mW", conformance: "FA & PFR" }),
    Field({ name: "MinDurationAdjustment", id: 16, type: "elapsed-s", conformance: "FA" }),
    Field({ name: "MaxDurationAdjustment", id: 17, type: "elapsed-s", conformance: "FA" })
  ),
  Datatype(
    { name: "SlotAdjustmentStruct", type: "struct" },
    Field({ name: "SlotIndex", id: 0, type: "uint8", conformance: "M", constraint: "desc" }),
    Field({ name: "NominalPower", id: 1, type: "power-mW", conformance: "PFR", constraint: "desc" }),
    Field({ name: "Duration", id: 2, type: "elapsed-s", conformance: "M", constraint: "desc" })
  ),
  Datatype(
    { name: "ConstraintsStruct", type: "struct" },
    Field({ name: "StartTime", id: 0, type: "epoch-s", conformance: "M", constraint: "desc" }),
    Field({ name: "Duration", id: 1, type: "elapsed-s", conformance: "M", constraint: "max 86400" }),
    Field({ name: "NominalPower", id: 2, type: "power-mW", conformance: "PFR", constraint: "desc" }),
    Field({ name: "MaximumEnergy", id: 3, type: "energy-mWh", conformance: "PFR" }),
    Field({ name: "LoadControl", id: 4, type: "int8", conformance: "SFR" })
  )
);
MatterDefinition.children.push(DeviceEnergyManagement);
export {
  DeviceEnergyManagement
};
//# sourceMappingURL=device-energy-management-cluster.element.js.map
