"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var rvc_operational_state_exports = {};
__export(rvc_operational_state_exports, {
  RvcOperationalState: () => RvcOperationalState,
  RvcOperationalStateCluster: () => RvcOperationalStateCluster
});
module.exports = __toCommonJS(rvc_operational_state_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvArray = require("../tlv/TlvArray.js");
var import_TlvString = require("../tlv/TlvString.js");
var import_TlvNullable = require("../tlv/TlvNullable.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_TlvObject = require("../tlv/TlvObject.js");
var import_operational_state = require("./operational-state.js");
var import_TlvNoArguments = require("../tlv/TlvNoArguments.js");
var import_Priority = require("../globals/Priority.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var RvcOperationalState;
((RvcOperationalState2) => {
  let OperationalState;
  ((OperationalState2) => {
    OperationalState2[OperationalState2["Stopped"] = 0] = "Stopped";
    OperationalState2[OperationalState2["Running"] = 1] = "Running";
    OperationalState2[OperationalState2["Paused"] = 2] = "Paused";
    OperationalState2[OperationalState2["Error"] = 3] = "Error";
    OperationalState2[OperationalState2["SeekingCharger"] = 64] = "SeekingCharger";
    OperationalState2[OperationalState2["Charging"] = 65] = "Charging";
    OperationalState2[OperationalState2["Docked"] = 66] = "Docked";
    OperationalState2[OperationalState2["EmptyingDustBin"] = 67] = "EmptyingDustBin";
    OperationalState2[OperationalState2["CleaningMop"] = 68] = "CleaningMop";
    OperationalState2[OperationalState2["FillingWaterTank"] = 69] = "FillingWaterTank";
    OperationalState2[OperationalState2["UpdatingMaps"] = 70] = "UpdatingMaps";
  })(OperationalState = RvcOperationalState2.OperationalState || (RvcOperationalState2.OperationalState = {}));
  RvcOperationalState2.TlvOperationalStateStruct = (0, import_TlvObject.TlvObject)({
    /**
     * This shall be populated with a value from the OperationalStateEnum.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.14.4.2.1
     */
    operationalStateId: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvEnum)()),
    /**
     * This field is present when the OperationalStateID is from the set reserved for Manufacturer Specific States.
     * If present, this shall contain a human-readable description of the operational state.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.14.4.2.2
     */
    operationalStateLabel: (0, import_TlvObject.TlvOptionalField)(1, import_TlvString.TlvString.bound({ maxLength: 64 }))
  });
  let ErrorState;
  ((ErrorState2) => {
    ErrorState2[ErrorState2["NoError"] = 0] = "NoError";
    ErrorState2[ErrorState2["UnableToStartOrResume"] = 1] = "UnableToStartOrResume";
    ErrorState2[ErrorState2["UnableToCompleteOperation"] = 2] = "UnableToCompleteOperation";
    ErrorState2[ErrorState2["CommandInvalidInState"] = 3] = "CommandInvalidInState";
    ErrorState2[ErrorState2["FailedToFindChargingDock"] = 64] = "FailedToFindChargingDock";
    ErrorState2[ErrorState2["Stuck"] = 65] = "Stuck";
    ErrorState2[ErrorState2["DustBinMissing"] = 66] = "DustBinMissing";
    ErrorState2[ErrorState2["DustBinFull"] = 67] = "DustBinFull";
    ErrorState2[ErrorState2["WaterTankEmpty"] = 68] = "WaterTankEmpty";
    ErrorState2[ErrorState2["WaterTankMissing"] = 69] = "WaterTankMissing";
    ErrorState2[ErrorState2["WaterTankLidOpen"] = 70] = "WaterTankLidOpen";
    ErrorState2[ErrorState2["MopCleaningPadMissing"] = 71] = "MopCleaningPadMissing";
    ErrorState2[ErrorState2["LowBattery"] = 72] = "LowBattery";
    ErrorState2[ErrorState2["CannotReachTargetArea"] = 73] = "CannotReachTargetArea";
    ErrorState2[ErrorState2["DirtyWaterTankFull"] = 74] = "DirtyWaterTankFull";
    ErrorState2[ErrorState2["DirtyWaterTankMissing"] = 75] = "DirtyWaterTankMissing";
    ErrorState2[ErrorState2["WheelsJammed"] = 76] = "WheelsJammed";
    ErrorState2[ErrorState2["BrushJammed"] = 77] = "BrushJammed";
    ErrorState2[ErrorState2["NavigationSensorObscured"] = 78] = "NavigationSensorObscured";
  })(ErrorState = RvcOperationalState2.ErrorState || (RvcOperationalState2.ErrorState = {}));
  RvcOperationalState2.TlvErrorStateStruct = (0, import_TlvObject.TlvObject)({
    /**
     * This shall be populated with a value from the ErrorStateEnum.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.14.4.4.1
     */
    errorStateId: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvEnum)()),
    /**
     * This field is present when the ErrorStateID is from the set reserved for Manufacturer Specific errors. If
     * present, this shall contain a human-readable description of the error state.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.14.4.4.2
     */
    errorStateLabel: (0, import_TlvObject.TlvOptionalField)(1, import_TlvString.TlvString.bound({ maxLength: 64 })),
    /**
     * This shall be a human-readable string that provides details about the error condition. As an example, if the
     * ErrorStateID indicates that the device is a Robotic Vacuum that is stuck, the ErrorStateDetails contains
     * "left wheel blocked".
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.14.4.4.3
     */
    errorStateDetails: (0, import_TlvObject.TlvOptionalField)(2, import_TlvString.TlvString.bound({ maxLength: 64 }))
  });
  RvcOperationalState2.TlvOperationalCommandResponse = (0, import_TlvObject.TlvObject)({
    /**
     * This shall indicate the success or otherwise of the attempted command invocation. On a successful invocation
     * of the attempted command, the ErrorStateID shall be populated with NoError. See the individual command
     * sections for additional specific requirements on population.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.14.6.5.1
     */
    commandResponseState: (0, import_TlvObject.TlvField)(0, RvcOperationalState2.TlvErrorStateStruct)
  });
  RvcOperationalState2.TlvOperationalErrorEvent = (0, import_TlvObject.TlvObject)({ errorState: (0, import_TlvObject.TlvField)(0, RvcOperationalState2.TlvErrorStateStruct) });
  RvcOperationalState2.ClusterInstance = (0, import_MutableCluster.MutableCluster)({
    id: 97,
    name: "RvcOperationalState",
    revision: 3,
    attributes: {
      /**
       * Indicates a list of names of different phases that the device can go through for the selected function or
       * mode. The list may not be in sequence order. For example in a washing machine this could include items
       * such as "pre-soak", "rinse", and "spin". These phases are manufacturer specific and may change when a
       * different function or mode is selected.
       *
       * A null value indicates that the device does not present phases during its operation. When this
       * attribute’s value is null, the CurrentPhase attribute shall also be set to null.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.14.5.1
       */
      phaseList: (0, import_Cluster.Attribute)(0, (0, import_TlvNullable.TlvNullable)((0, import_TlvArray.TlvArray)(import_TlvString.TlvString, { maxLength: 32 }))),
      /**
       * This attribute represents the current phase of operation being performed by the server. This shall be the
       * positional index representing the value from the set provided in the PhaseList Attribute, where the first
       * item in that list is an index of 0. Thus, this attribute shall have a maximum value that is
       * "length(PhaseList) - 1".
       *
       * Null if the PhaseList attribute is null or if the PhaseList attribute is an empty list.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.14.5.2
       */
      currentPhase: (0, import_Cluster.Attribute)(1, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvUInt8)),
      /**
       * Indicates the estimated time left before the operation is completed, in seconds.
       *
       * A value of 0 (zero) means that the operation has completed.
       *
       * A value of null represents that there is no time currently defined until operation completion. This may
       * happen, for example, because no operation is in progress or because the completion time is unknown.
       *
       * Changes to this attribute shall only be marked as reportable in the following cases:
       *
       *   - If it has changed due to a change in the CurrentPhase or OperationalState attributes, or
       *
       *   - When it changes from 0 to any other value and vice versa, or
       *
       *   - When it changes from null to any other value and vice versa, or
       *
       *   - When it increases, or
       *
       *   - When there is any increase or decrease in the estimated time remaining that was due to progressing
       *     insight of the server’s control logic, or
       *
       *   - When it changes at a rate significantly different from one unit per second.
       *
       * Changes to this attribute merely due to the normal passage of time with no other dynamic change of device
       * state shall NOT be reported.
       *
       * As this attribute is not being reported during a regular countdown, clients SHOULD NOT rely on the
       * reporting of this attribute in order to keep track of the remaining duration.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.14.5.3
       */
      countdownTime: (0, import_Cluster.OptionalAttribute)(2, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvUInt32.bound({ max: 259200 })), { default: null }),
      /**
       * This attribute describes the set of possible operational states that the device exposes. An operational
       * state is a fundamental device state such as Running or Error. Details of the phase of a device when, for
       * example, in a state of Running are provided by the CurrentPhase attribute.
       *
       * All devices shall, at a minimum, expose the set of states matching the commands that are also supported
       * by the cluster instance, in addition to Error. The set of possible device states are defined in the
       * OperationalStateEnum. A device type requiring implementation of this cluster shall define the set of
       * states that are applicable to that specific device type.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.14.5.4
       */
      operationalStateList: (0, import_Cluster.Attribute)(3, (0, import_TlvArray.TlvArray)(RvcOperationalState2.TlvOperationalStateStruct), { default: [] }),
      /**
       * This attribute specifies the current operational state of a device. This shall be populated with a valid
       * OperationalStateID from the set of values in the OperationalStateList Attribute.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.14.5.5
       */
      operationalState: (0, import_Cluster.Attribute)(
        4,
        (0, import_TlvNumber.TlvEnum)()
      ),
      /**
       * This attribute shall specify the details of any current error condition being experienced on the device
       * when the OperationalState attribute is populated with Error. See Section 1.14.4.4, “ErrorStateStruct
       * Type” for general requirements on the population of this attribute.
       *
       * When there is no error detected, this shall have an ErrorStateID of NoError.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.14.5.6
       */
      operationalError: (0, import_Cluster.Attribute)(5, RvcOperationalState2.TlvErrorStateStruct)
    },
    commands: {
      /**
       * @see {@link MatterSpecification.v142.Cluster} § 7.4.5
       */
      pause: (0, import_Cluster.Command)(0, import_TlvNoArguments.TlvNoArguments, 4, RvcOperationalState2.TlvOperationalCommandResponse),
      /**
       * @see {@link MatterSpecification.v142.Cluster} § 7.4.5
       */
      resume: (0, import_Cluster.Command)(3, import_TlvNoArguments.TlvNoArguments, 4, RvcOperationalState2.TlvOperationalCommandResponse),
      /**
       * On receipt of this command, the device shall start seeking the charging dock, if possible in the current
       * state of the device.
       *
       * If this command is received when already in the SeekingCharger state the device shall respond with an
       * OperationalCommandResponse command with an ErrorStateID of NoError but the command shall have no other
       * effect.
       *
       * A device that receives this command in any state which does not allow seeking the charger, such as
       * Charging or Docked, shall respond with an OperationalCommandResponse command with an ErrorStateID of
       * CommandInvalidInState and shall have no other effect.
       *
       * Otherwise, on success:
       *
       *   - The OperationalState attribute shall be set to SeekingCharger.
       *
       *   - The device shall respond with an OperationalCommandResponse command with an ErrorStateID of NoError.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 7.4.5.1
       */
      goHome: (0, import_Cluster.OptionalCommand)(128, import_TlvNoArguments.TlvNoArguments, 4, RvcOperationalState2.TlvOperationalCommandResponse)
    },
    events: {
      /**
       * This event is generated when a reportable error condition is detected. A device that generates this event
       * shall also set the OperationalState attribute to Error, indicating an error condition.
       *
       * This event shall contain the following fields:
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.14.7.1
       */
      operationalError: (0, import_Cluster.Event)(0, import_Priority.Priority.Critical, RvcOperationalState2.TlvOperationalErrorEvent),
      /**
       * This event SHOULD be generated when the overall operation ends, successfully or otherwise. For example,
       * the completion of a cleaning operation in a Robot Vacuum Cleaner, or the completion of a wash cycle in a
       * Washing Machine.
       *
       * It is highly recommended that appliances device types employing the Operational State cluster support
       * this event, even if it is optional. This assists clients in executing automations or issuing
       * notifications at critical points in the device operation cycles.
       *
       * This event shall contain the following fields:
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.14.7.2
       */
      operationCompletion: (0, import_Cluster.OptionalEvent)(
        1,
        import_Priority.Priority.Info,
        import_operational_state.OperationalState.TlvOperationCompletionEvent
      )
    }
  });
  RvcOperationalState2.Cluster = RvcOperationalState2.ClusterInstance;
  RvcOperationalState2.Complete = RvcOperationalState2.Cluster;
})(RvcOperationalState || (RvcOperationalState = {}));
const RvcOperationalStateCluster = RvcOperationalState.Cluster;
import_ClusterRegistry.ClusterRegistry.register(RvcOperationalState.Complete);
//# sourceMappingURL=rvc-operational-state.js.map
