"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 microwave_oven_control_exports = {};
__export(microwave_oven_control_exports, {
  MicrowaveOvenControl: () => MicrowaveOvenControl,
  MicrowaveOvenControlCluster: () => MicrowaveOvenControlCluster
});
module.exports = __toCommonJS(microwave_oven_control_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_TlvArray = require("../tlv/TlvArray.js");
var import_BitmapSchema = require("../schema/BitmapSchema.js");
var import_TlvObject = require("../tlv/TlvObject.js");
var import_TlvBoolean = require("../tlv/TlvBoolean.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var MicrowaveOvenControl;
((MicrowaveOvenControl2) => {
  let Feature;
  ((Feature2) => {
    Feature2["PowerAsNumber"] = "PowerAsNumber";
    Feature2["PowerInWatts"] = "PowerInWatts";
    Feature2["PowerNumberLimits"] = "PowerNumberLimits";
  })(Feature = MicrowaveOvenControl2.Feature || (MicrowaveOvenControl2.Feature = {}));
  MicrowaveOvenControl2.TlvSetCookingParametersRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the value to which the CurrentMode attribute of the Microwave Oven Mode cluster
     * should be set. The value of this field shall be one from the list of SupportedModes from the Microwave Oven
     * Mode cluster.
     *
     * If this field is missing, the CurrentMode attribute shall be set to a mode having the Normal mode tag.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 8.13.6.2.1
     */
    cookMode: (0, import_TlvObject.TlvOptionalField)(0, import_TlvNumber.TlvUInt8),
    /**
     * This field shall indicate the CookTime associated with the operation of the device. The value of this field
     * shall be subject to the constraints of the CookTime attribute of this cluster.
     *
     * If this field is missing, the CookTime attribute shall be set to 30 seconds by the server.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 8.13.6.2.2
     */
    cookTime: (0, import_TlvObject.TlvOptionalField)(1, import_TlvNumber.TlvUInt32.bound({ min: 1 })),
    /**
     * This field shall indicate the PowerSetting associated with the operation of the device. The value of this
     * field shall be subject to the constraints of the PowerSetting attribute of this cluster. If the PowerSetting
     * field does not conform to the constraints of the PowerSetting attribute, the server shall return a
     * CONSTRAINT_ERROR status.
     *
     * If this field is missing, the PowerSetting attribute shall be set to 100 if MaxPower is not supported by the
     * server, otherwise it shall be set to MaxPower if the MaxPower attribute is supported by the server.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 8.13.6.2.3
     */
    powerSetting: (0, import_TlvObject.TlvOptionalField)(2, import_TlvNumber.TlvUInt8),
    /**
     * This field shall indicate the value to which the SelectedWattIndex attribute is set. If the value of this
     * field is greater than or equal to the length of the SupportedWatts attribute list, the server shall return a
     * CONSTRAINT_ERROR status and the value of the SelectedWattIndex attribute shall be unchanged.
     *
     * If this field is missing, the SelectedWattIndex attribute shall be set by the server to the index associated
     * with the highest Watt setting for the selected CookMode.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 8.13.6.2.4
     */
    wattSettingIndex: (0, import_TlvObject.TlvOptionalField)(3, import_TlvNumber.TlvUInt8),
    /**
     * This field shall indicate whether or not oven operation shall be started when the command is received.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 8.13.6.2.5
     */
    startAfterSetting: (0, import_TlvObject.TlvOptionalField)(4, import_TlvBoolean.TlvBoolean)
  });
  MicrowaveOvenControl2.TlvAddMoreTimeRequest = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the number of seconds to be added to the CookTime attribute.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 8.13.6.3.1
     */
    timeToAdd: (0, import_TlvObject.TlvField)(0, import_TlvNumber.TlvUInt32.bound({ min: 1 }))
  });
  MicrowaveOvenControl2.PowerAsNumberComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates the power level associated with the operation of the device. If the MinPower, MaxPower, and
       * PowerStep attributes are not supported:
       *
       *   • The minimum value of this attribute shall be 10,
       *
       *   • The maximum value of this attribute shall be 100,
       *
       *   • The value shall be in even multiples of 10,
       *
       *   • The default value shall be 100.
       *
       * If the MinPower, MaxPower, and PowerStep attributes are supported:
       *
       *   • The value of this attribute shall be between MinPower and MaxPower inclusive.
       *
       *   • The value of this attribute shall be such that (PowerSetting - MinPower) % PowerStep == 0
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.3
       */
      powerSetting: (0, import_Cluster.Attribute)(2, import_TlvNumber.TlvUInt8)
    }
  });
  MicrowaveOvenControl2.PowerNumberLimitsComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates the minimum value to which the PowerSetting attribute that can be set on the server.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.4
       */
      minPower: (0, import_Cluster.FixedAttribute)(3, import_TlvNumber.TlvUInt8.bound({ min: 1, max: 99 })),
      /**
       * Indicates the maximum value to which the PowerSetting attribute that can be set on the server.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.5
       */
      maxPower: (0, import_Cluster.FixedAttribute)(4, import_TlvNumber.TlvUInt8.bound({ max: 100 })),
      /**
       * Indicates the increment of power that can be set on the server. The value of this attribute shall be
       * between 1 and MaxPower inclusive.
       *
       * The value of this attribute shall be such that (MaxPower - MinPower) % PowerStep == 0
       *
       * For example, if MinPower is 1, MaxPower is 10, and PowerSetting can be set to any integer between
       * MinPower and MaxPower, PowerStep would be set to 1.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.6
       */
      powerStep: (0, import_Cluster.FixedAttribute)(5, import_TlvNumber.TlvUInt8)
    }
  });
  MicrowaveOvenControl2.PowerInWattsComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * Indicates the list of power levels (in W) supported by the server.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.7
       */
      supportedWatts: (0, import_Cluster.FixedAttribute)(6, (0, import_TlvArray.TlvArray)(import_TlvNumber.TlvUInt16, { minLength: 1, maxLength: 10 })),
      /**
       * Indicates the index into the list of SupportedWatts of the currently selected power setting.
       *
       * The index shall be a valid index into the SupportedWatts list.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.8
       */
      selectedWattIndex: (0, import_Cluster.Attribute)(7, import_TlvNumber.TlvUInt8)
    }
  });
  MicrowaveOvenControl2.Base = import_MutableCluster.MutableCluster.Component({
    id: 95,
    name: "MicrowaveOvenControl",
    revision: 1,
    features: {
      /**
       * Power is specified as a unitless number or a percentage
       */
      powerAsNumber: (0, import_BitmapSchema.BitFlag)(0),
      /**
       * Power is specified in Watts
       */
      powerInWatts: (0, import_BitmapSchema.BitFlag)(1),
      /**
       * Supports the limit attributes used with the PWRNUM feature
       */
      powerNumberLimits: (0, import_BitmapSchema.BitFlag)(2)
    },
    attributes: {
      /**
       * Indicates the total cook time associated with the operation of the device.
       *
       * This attribute shall remain unchanged during the operation of the oven unless the value is changed via a
       * command or out-of-band action.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.1
       */
      cookTime: (0, import_Cluster.Attribute)(0, import_TlvNumber.TlvUInt32.bound({ min: 1 })),
      /**
       * Indicates the maximum value to which the CookTime attribute can be set.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.2
       */
      maxCookTime: (0, import_Cluster.FixedAttribute)(1, import_TlvNumber.TlvUInt32.bound({ min: 1, max: 86400 })),
      /**
       * Indicates the rating, in Watts, of the microwave power of the oven.
       *
       * Supporting this attribute can assist clients in suggesting cooking settings for various foods and
       * beverages.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.5.9
       */
      wattRating: (0, import_Cluster.OptionalFixedAttribute)(8, import_TlvNumber.TlvUInt16)
    },
    commands: {
      /**
       * This command is used to set the cooking parameters associated with the operation of the device. This
       * command supports the following fields:
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.6.2
       */
      setCookingParameters: (0, import_Cluster.Command)(0, MicrowaveOvenControl2.TlvSetCookingParametersRequest, 0, import_Cluster.TlvNoResponse),
      /**
       * This command is used to add more time to the CookTime attribute of the server. This command supports
       * these fields:
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.13.6.3
       */
      addMoreTime: (0, import_Cluster.OptionalCommand)(1, MicrowaveOvenControl2.TlvAddMoreTimeRequest, 1, import_Cluster.TlvNoResponse)
    },
    /**
     * This metadata controls which MicrowaveOvenControlCluster elements matter.js activates for specific feature
     * combinations.
     */
    extensions: import_MutableCluster.MutableCluster.Extensions(
      { flags: { powerAsNumber: true }, component: MicrowaveOvenControl2.PowerAsNumberComponent },
      { flags: { powerNumberLimits: true }, component: MicrowaveOvenControl2.PowerNumberLimitsComponent },
      { flags: { powerInWatts: true }, component: MicrowaveOvenControl2.PowerInWattsComponent },
      { flags: { powerNumberLimits: true, powerAsNumber: false }, component: false },
      { flags: { powerAsNumber: true, powerInWatts: true }, component: false },
      { flags: { powerAsNumber: false, powerInWatts: false }, component: false }
    )
  });
  MicrowaveOvenControl2.ClusterInstance = import_MutableCluster.MutableCluster.ExtensibleOnly(MicrowaveOvenControl2.Base);
  MicrowaveOvenControl2.Cluster = MicrowaveOvenControl2.ClusterInstance;
  const PWRNUM = { powerAsNumber: true };
  const PWRLMTS = { powerNumberLimits: true };
  const WATTS = { powerInWatts: true };
  MicrowaveOvenControl2.CompleteInstance = (0, import_MutableCluster.MutableCluster)({
    id: MicrowaveOvenControl2.Base.id,
    name: MicrowaveOvenControl2.Base.name,
    revision: MicrowaveOvenControl2.Base.revision,
    features: MicrowaveOvenControl2.Base.features,
    attributes: {
      ...MicrowaveOvenControl2.Base.attributes,
      powerSetting: import_MutableCluster.MutableCluster.AsConditional(
        MicrowaveOvenControl2.PowerAsNumberComponent.attributes.powerSetting,
        { mandatoryIf: [PWRNUM] }
      ),
      minPower: import_MutableCluster.MutableCluster.AsConditional(
        MicrowaveOvenControl2.PowerNumberLimitsComponent.attributes.minPower,
        { mandatoryIf: [PWRLMTS] }
      ),
      maxPower: import_MutableCluster.MutableCluster.AsConditional(
        MicrowaveOvenControl2.PowerNumberLimitsComponent.attributes.maxPower,
        { mandatoryIf: [PWRLMTS] }
      ),
      powerStep: import_MutableCluster.MutableCluster.AsConditional(
        MicrowaveOvenControl2.PowerNumberLimitsComponent.attributes.powerStep,
        { mandatoryIf: [PWRLMTS] }
      ),
      supportedWatts: import_MutableCluster.MutableCluster.AsConditional(
        MicrowaveOvenControl2.PowerInWattsComponent.attributes.supportedWatts,
        { mandatoryIf: [WATTS] }
      ),
      selectedWattIndex: import_MutableCluster.MutableCluster.AsConditional(
        MicrowaveOvenControl2.PowerInWattsComponent.attributes.selectedWattIndex,
        { mandatoryIf: [WATTS] }
      )
    },
    commands: MicrowaveOvenControl2.Base.commands
  });
  MicrowaveOvenControl2.Complete = MicrowaveOvenControl2.CompleteInstance;
})(MicrowaveOvenControl || (MicrowaveOvenControl = {}));
const MicrowaveOvenControlCluster = MicrowaveOvenControl.Cluster;
import_ClusterRegistry.ClusterRegistry.register(MicrowaveOvenControl.Complete);
//# sourceMappingURL=microwave-oven-control.js.map
