/**
 * @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,
  CommandElement as Command,
  DatatypeElement as Datatype
} from "../../elements/index.js";
const EnergyEvse = Cluster(
  { name: "EnergyEvse", id: 153, classification: "application" },
  Attribute({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 3 }),
  Attribute(
    { name: "FeatureMap", id: 65532, type: "FeatureMap" },
    Field({ name: "PREF", conformance: "M", constraint: "0", title: "ChargingPreferences" }),
    Field({ name: "SOC", conformance: "P, O", constraint: "1", title: "SoCReporting" }),
    Field({ name: "PNC", conformance: "P, O", constraint: "2", title: "PlugAndCharge" }),
    Field({ name: "RFID", conformance: "O", constraint: "3", title: "Rfid" }),
    Field({ name: "V2X", conformance: "P, O", constraint: "4", title: "V2X" })
  ),
  Attribute({ name: "State", id: 0, type: "StateEnum", access: "R V", conformance: "M", quality: "X" }),
  Attribute({ name: "SupplyState", id: 1, type: "SupplyStateEnum", access: "R V", conformance: "M" }),
  Attribute({ name: "FaultState", id: 2, type: "FaultStateEnum", access: "R V", conformance: "M" }),
  Attribute({ name: "ChargingEnabledUntil", id: 3, type: "epoch-s", access: "R V", conformance: "M", quality: "X N" }),
  Attribute({ name: "DischargingEnabledUntil", id: 4, type: "epoch-s", access: "R V", conformance: "V2X", quality: "X N" }),
  Attribute({
    name: "CircuitCapacity",
    id: 5,
    type: "amperage-mA",
    access: "R V",
    conformance: "M",
    constraint: "min 0",
    quality: "N"
  }),
  Attribute({
    name: "MinimumChargeCurrent",
    id: 6,
    type: "amperage-mA",
    access: "R V",
    conformance: "M",
    constraint: "min 0",
    quality: "N"
  }),
  Attribute({
    name: "MaximumChargeCurrent",
    id: 7,
    type: "amperage-mA",
    access: "R V",
    conformance: "M",
    constraint: "min 0",
    quality: "N"
  }),
  Attribute({
    name: "MaximumDischargeCurrent",
    id: 8,
    type: "amperage-mA",
    access: "R V",
    conformance: "V2X",
    constraint: "min 0",
    quality: "N"
  }),
  Attribute({
    name: "UserMaximumChargeCurrent",
    id: 9,
    type: "amperage-mA",
    access: "RW VM",
    conformance: "O",
    constraint: "desc",
    default: 0,
    quality: "N"
  }),
  Attribute({
    name: "RandomizationDelayWindow",
    id: 10,
    type: "elapsed-s",
    access: "RW VM",
    conformance: "O",
    constraint: "max 86400",
    default: 600,
    quality: "N"
  }),
  Attribute({ name: "NextChargeStartTime", id: 35, type: "epoch-s", access: "R V", conformance: "PREF", quality: "X" }),
  Attribute(
    { name: "NextChargeTargetTime", id: 36, type: "epoch-s", access: "R V", conformance: "PREF", quality: "X" }
  ),
  Attribute({
    name: "NextChargeRequiredEnergy",
    id: 37,
    type: "energy-mWh",
    access: "R V",
    conformance: "PREF",
    constraint: "min 0",
    quality: "X"
  }),
  Attribute({ name: "NextChargeTargetSoC", id: 38, type: "percent", access: "R V", conformance: "PREF", quality: "X" }),
  Attribute({
    name: "ApproximateEvEfficiency",
    id: 39,
    type: "uint16",
    access: "RW VM",
    conformance: "[PREF]",
    constraint: "desc",
    default: null,
    quality: "X N"
  }),
  Attribute({ name: "StateOfCharge", id: 48, type: "percent", access: "R V", conformance: "SOC", quality: "X" }),
  Attribute({
    name: "BatteryCapacity",
    id: 49,
    type: "energy-mWh",
    access: "R V",
    conformance: "SOC",
    constraint: "min 0",
    quality: "X"
  }),
  Attribute({
    name: "VehicleId",
    id: 50,
    type: "string",
    access: "R V",
    conformance: "PNC",
    constraint: "max 32",
    quality: "X"
  }),
  Attribute({ name: "SessionId", id: 64, type: "uint32", access: "R V", conformance: "M", quality: "X N" }),
  Attribute({ name: "SessionDuration", id: 65, type: "elapsed-s", access: "R V", conformance: "M", quality: "X N Q" }),
  Attribute({
    name: "SessionEnergyCharged",
    id: 66,
    type: "energy-mWh",
    access: "R V",
    conformance: "M",
    constraint: "min 0",
    quality: "X N Q"
  }),
  Attribute({
    name: "SessionEnergyDischarged",
    id: 67,
    type: "energy-mWh",
    access: "R V",
    conformance: "V2X",
    constraint: "min 0",
    quality: "X N Q"
  }),
  Event(
    { name: "EvConnected", id: 0, access: "V", conformance: "M", priority: "info" },
    Field({ name: "SessionId", id: 0, type: "uint32", conformance: "M" })
  ),
  Event(
    { name: "EvNotDetected", id: 1, access: "V", conformance: "M", priority: "info" },
    Field({ name: "SessionId", id: 0, type: "uint32", conformance: "M" }),
    Field({ name: "State", id: 1, type: "StateEnum", conformance: "M" }),
    Field({ name: "SessionDuration", id: 2, type: "elapsed-s", conformance: "M" }),
    Field({ name: "SessionEnergyCharged", id: 3, type: "energy-mWh", conformance: "M", constraint: "min 0" }),
    Field({ name: "SessionEnergyDischarged", id: 4, type: "energy-mWh", conformance: "V2X", constraint: "min 0" })
  ),
  Event(
    { name: "EnergyTransferStarted", id: 2, access: "V", conformance: "M", priority: "info" },
    Field({ name: "SessionId", id: 0, type: "uint32", conformance: "M" }),
    Field({ name: "State", id: 1, type: "StateEnum", conformance: "M" }),
    Field({ name: "MaximumCurrent", id: 2, type: "amperage-mA", conformance: "M", constraint: "min 0" }),
    Field({ name: "MaximumDischargeCurrent", id: 3, type: "amperage-mA", conformance: "V2X", constraint: "min 0" })
  ),
  Event(
    { name: "EnergyTransferStopped", id: 3, access: "V", conformance: "M", priority: "info" },
    Field({ name: "SessionId", id: 0, type: "uint32", conformance: "M" }),
    Field({ name: "State", id: 1, type: "StateEnum", conformance: "M" }),
    Field({ name: "Reason", id: 2, type: "EnergyTransferStoppedReasonEnum", conformance: "M" }),
    Field({ name: "EnergyTransferred", id: 4, type: "energy-mWh", conformance: "M", constraint: "min 0" }),
    Field({ name: "EnergyDischarged", id: 5, type: "energy-mWh", conformance: "V2X", constraint: "min 0" })
  ),
  Event(
    { name: "Fault", id: 4, access: "V", conformance: "M", priority: "critical" },
    Field({ name: "SessionId", id: 0, type: "uint32", conformance: "M", quality: "X" }),
    Field({ name: "State", id: 1, type: "StateEnum", conformance: "M" }),
    Field({ name: "FaultStatePreviousState", id: 2, type: "FaultStateEnum", conformance: "M" }),
    Field({ name: "FaultStateCurrentState", id: 4, type: "FaultStateEnum", conformance: "M" })
  ),
  Event(
    { name: "Rfid", id: 5, access: "V", conformance: "[RFID]", priority: "info" },
    Field({ name: "Uid", id: 0, type: "octstr", conformance: "M", constraint: "max 10" })
  ),
  Command({ name: "Disable", id: 1, access: "O T", conformance: "M", direction: "request", response: "status" }),
  Command(
    { name: "EnableCharging", id: 2, access: "O T", conformance: "M", direction: "request", response: "status" },
    Field({ name: "ChargingEnabledUntil", id: 0, type: "epoch-s", conformance: "M", quality: "X" }),
    Field({ name: "MinimumChargeCurrent", id: 1, type: "amperage-mA", conformance: "M", constraint: "min 0" }),
    Field({ name: "MaximumChargeCurrent", id: 2, type: "amperage-mA", conformance: "M", constraint: "min 0" })
  ),
  Command(
    {
      name: "EnableDischarging",
      id: 3,
      access: "O T",
      conformance: "V2X",
      direction: "request",
      response: "status"
    },
    Field({ name: "DischargingEnabledUntil", id: 0, type: "epoch-s", conformance: "M", quality: "X" }),
    Field({ name: "MaximumDischargeCurrent", id: 1, type: "amperage-mA", conformance: "M", constraint: "min 0" })
  ),
  Command({ name: "StartDiagnostics", id: 4, access: "O T", conformance: "O", direction: "request", response: "status" }),
  Command(
    { name: "SetTargets", id: 5, access: "O T", conformance: "PREF", direction: "request", response: "status" },
    Field(
      { name: "ChargingTargetSchedules", id: 0, type: "list", conformance: "M", constraint: "max 7" },
      Field({ name: "entry", type: "ChargingTargetScheduleStruct" })
    )
  ),
  Command({
    name: "GetTargets",
    id: 6,
    access: "O T",
    conformance: "PREF",
    direction: "request",
    response: "GetTargetsResponse"
  }),
  Command(
    { name: "ClearTargets", id: 7, access: "O T", conformance: "PREF", direction: "request", response: "status" }
  ),
  Command(
    { name: "GetTargetsResponse", id: 0, conformance: "PREF", direction: "response" },
    Field(
      { name: "ChargingTargetSchedules", id: 0, type: "list", conformance: "M", constraint: "max 7" },
      Field({ name: "entry", type: "ChargingTargetScheduleStruct" })
    )
  ),
  Datatype(
    { name: "TargetDayOfWeekBitmap", type: "map8" },
    Field({ name: "Sunday", constraint: "0" }),
    Field({ name: "Monday", constraint: "1" }),
    Field({ name: "Tuesday", constraint: "2" }),
    Field({ name: "Wednesday", constraint: "3" }),
    Field({ name: "Thursday", constraint: "4" }),
    Field({ name: "Friday", constraint: "5" }),
    Field({ name: "Saturday", constraint: "6" })
  ),
  Datatype(
    { name: "StateEnum", type: "enum8" },
    Field({ name: "NotPluggedIn", id: 0, conformance: "M" }),
    Field({ name: "PluggedInNoDemand", id: 1, conformance: "M" }),
    Field({ name: "PluggedInDemand", id: 2, conformance: "M" }),
    Field({ name: "PluggedInCharging", id: 3, conformance: "M" }),
    Field({ name: "PluggedInDischarging", id: 4, conformance: "V2X" }),
    Field({ name: "SessionEnding", id: 5, conformance: "M" }),
    Field({ name: "Fault", id: 6, conformance: "M" })
  ),
  Datatype(
    { name: "SupplyStateEnum", type: "enum8" },
    Field({ name: "Disabled", id: 0, conformance: "M" }),
    Field({ name: "ChargingEnabled", id: 1, conformance: "M" }),
    Field({ name: "DischargingEnabled", id: 2, conformance: "[V2X]" }),
    Field({ name: "DisabledError", id: 3, conformance: "M" }),
    Field({ name: "DisabledDiagnostics", id: 4, conformance: "M" }),
    Field({ name: "Enabled", id: 5, conformance: "[V2X]" })
  ),
  Datatype(
    { name: "FaultStateEnum", type: "enum8" },
    Field({ name: "NoError", id: 0, conformance: "M" }),
    Field({ name: "MeterFailure", id: 1, conformance: "M" }),
    Field({ name: "OverVoltage", id: 2, conformance: "M" }),
    Field({ name: "UnderVoltage", id: 3, conformance: "M" }),
    Field({ name: "OverCurrent", id: 4, conformance: "M" }),
    Field({ name: "ContactWetFailure", id: 5, conformance: "M" }),
    Field({ name: "ContactDryFailure", id: 6, conformance: "M" }),
    Field({ name: "GroundFault", id: 7, conformance: "M" }),
    Field({ name: "PowerLoss", id: 8, conformance: "M" }),
    Field({ name: "PowerQuality", id: 9, conformance: "M" }),
    Field({ name: "PilotShortCircuit", id: 10, conformance: "M" }),
    Field({ name: "EmergencyStop", id: 11, conformance: "M" }),
    Field({ name: "EvDisconnected", id: 12, conformance: "M" }),
    Field({ name: "WrongPowerSupply", id: 13, conformance: "M" }),
    Field({ name: "LiveNeutralSwap", id: 14, conformance: "M" }),
    Field({ name: "OverTemperature", id: 15, conformance: "M" }),
    Field({ name: "Other", id: 255, conformance: "M" })
  ),
  Datatype(
    { name: "EnergyTransferStoppedReasonEnum", type: "enum8" },
    Field({ name: "EvStopped", id: 0, conformance: "M" }),
    Field({ name: "EvseStopped", id: 1, conformance: "M" }),
    Field({ name: "Other", id: 2, conformance: "M" })
  ),
  Datatype(
    { name: "ChargingTargetStruct", type: "struct" },
    Field({ name: "TargetTimeMinutesPastMidnight", id: 0, type: "uint16", conformance: "M", constraint: "max 1439" }),
    Field({ name: "TargetSoC", id: 1, type: "percent", conformance: "SOC, O.a+", default: 0 }),
    Field({
      name: "AddedEnergy",
      id: 2,
      type: "energy-mWh",
      conformance: "[SOC], O.a+",
      constraint: "min 0",
      default: 0
    })
  ),
  Datatype(
    { name: "ChargingTargetScheduleStruct", type: "struct" },
    Field({ name: "DayOfWeekForSequence", id: 0, type: "TargetDayOfWeekBitmap", conformance: "M" }),
    Field(
      { name: "ChargingTargets", id: 1, type: "list", conformance: "M", constraint: "max 10" },
      Field({ name: "entry", type: "ChargingTargetStruct" })
    )
  )
);
MatterDefinition.children.push(EnergyEvse);
export {
  EnergyEvse
};
//# sourceMappingURL=energy-evse-cluster.element.js.map
