/**
 * @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 OperationalState = Cluster(
  { name: "OperationalState", id: 96, classification: "application" },
  Attribute({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 3 }),
  Attribute(
    {
      name: "PhaseList",
      id: 0,
      type: "list",
      access: "R V",
      conformance: "M",
      constraint: "max 32[max 64]",
      quality: "X"
    },
    Field({ name: "entry", type: "string" })
  ),
  Attribute({ name: "CurrentPhase", id: 1, type: "uint8", access: "R V", conformance: "M", constraint: "desc", quality: "X" }),
  Attribute({
    name: "CountdownTime",
    id: 2,
    type: "elapsed-s",
    access: "R V",
    conformance: "O",
    constraint: "max 259200",
    default: null,
    quality: "X Q"
  }),
  Attribute(
    { name: "OperationalStateList", id: 3, type: "list", access: "R V", conformance: "M", constraint: "desc" },
    Field({ name: "entry", type: "OperationalStateStruct" })
  ),
  Attribute({ name: "OperationalState", id: 4, type: "OperationalStateEnum", access: "R V", conformance: "M" }),
  Attribute({
    name: "OperationalError",
    id: 5,
    type: "ErrorStateStruct",
    access: "R V",
    conformance: "M",
    constraint: "desc"
  }),
  Event(
    { name: "OperationalError", id: 0, access: "V", conformance: "M", priority: "critical" },
    Field({ name: "ErrorState", id: 0, type: "ErrorStateStruct", conformance: "M" })
  ),
  Event(
    { name: "OperationCompletion", id: 1, access: "V", conformance: "O", priority: "info" },
    Field({ name: "CompletionErrorCode", id: 0, type: "enum8", conformance: "M" }),
    Field({ name: "TotalOperationalTime", id: 1, type: "elapsed-s", conformance: "O", quality: "X" }),
    Field({ name: "PausedTime", id: 2, type: "elapsed-s", conformance: "O", quality: "X" })
  ),
  Command({
    name: "Pause",
    id: 0,
    access: "O",
    conformance: "Resume, O",
    direction: "request",
    response: "OperationalCommandResponse"
  }),
  Command({
    name: "Stop",
    id: 1,
    access: "O",
    conformance: "Start, O",
    direction: "request",
    response: "OperationalCommandResponse"
  }),
  Command({
    name: "Start",
    id: 2,
    access: "O",
    conformance: "O",
    direction: "request",
    response: "OperationalCommandResponse"
  }),
  Command({
    name: "Resume",
    id: 3,
    access: "O",
    conformance: "Pause, O",
    direction: "request",
    response: "OperationalCommandResponse"
  }),
  Command(
    {
      name: "OperationalCommandResponse",
      id: 4,
      access: "O",
      conformance: "Pause | Stop | Start | Resume",
      direction: "response"
    },
    Field({ name: "CommandResponseState", id: 0, type: "ErrorStateStruct", conformance: "M" })
  ),
  Datatype(
    { name: "OperationalStateEnum", type: "enum8" },
    Field({ name: "Stopped", id: 0, conformance: "M" }),
    Field({ name: "Running", id: 1, conformance: "M" }),
    Field({ name: "Paused", id: 2, conformance: "M" }),
    Field({ name: "Error", id: 3, conformance: "M" })
  ),
  Datatype(
    { name: "OperationalStateStruct", type: "struct" },
    Field({ name: "OperationalStateId", id: 0, type: "OperationalStateEnum", conformance: "M", default: 0 }),
    Field({
      name: "OperationalStateLabel",
      id: 1,
      type: "string",
      conformance: "OperationalStateID >= 128 & OperationalStateID <= 191",
      constraint: "max 64"
    })
  ),
  Datatype(
    { name: "ErrorStateEnum", type: "enum8" },
    Field({ name: "NoError", id: 0, conformance: "M" }),
    Field({ name: "UnableToStartOrResume", id: 1, conformance: "M" }),
    Field({ name: "UnableToCompleteOperation", id: 2, conformance: "M" }),
    Field({ name: "CommandInvalidInState", id: 3, conformance: "M" })
  ),
  Datatype(
    { name: "ErrorStateStruct", type: "struct" },
    Field({ name: "ErrorStateId", id: 0, type: "ErrorStateEnum", conformance: "M", default: 0 }),
    Field({
      name: "ErrorStateLabel",
      id: 1,
      type: "string",
      conformance: "ErrorStateID >= 128 & ErrorStateID <= 191",
      constraint: "max 64"
    }),
    Field({ name: "ErrorStateDetails", id: 2, type: "string", conformance: "O", constraint: "max 64" })
  )
);
MatterDefinition.children.push(OperationalState);
export {
  OperationalState
};
//# sourceMappingURL=operational-state.element.js.map
