/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MutableCluster } from "../cluster/mutation/MutableCluster.js";
import { BitFlag } from "../schema/BitmapSchema.js";
import { FixedAttribute, Attribute, Command } from "../cluster/Cluster.js";
import { TlvArray } from "../tlv/TlvArray.js";
import { TlvField, TlvOptionalField, TlvObject } from "../tlv/TlvObject.js";
import { TlvString } from "../tlv/TlvString.js";
import { TlvUInt8, TlvEnum } from "../tlv/TlvNumber.js";
import { TlvVendorId } from "../datatype/VendorId.js";
import { ModeBase } from "./mode-base.js";
import { ClusterRegistry } from "../cluster/ClusterRegistry.js";
var LaundryWasherMode;
((LaundryWasherMode2) => {
  let Feature;
  ((Feature2) => {
    Feature2["OnOff"] = "OnOff";
  })(Feature = LaundryWasherMode2.Feature || (LaundryWasherMode2.Feature = {}));
  let ModeTag;
  ((ModeTag2) => {
    ModeTag2[ModeTag2["Auto"] = 0] = "Auto";
    ModeTag2[ModeTag2["Quick"] = 1] = "Quick";
    ModeTag2[ModeTag2["Quiet"] = 2] = "Quiet";
    ModeTag2[ModeTag2["LowNoise"] = 3] = "LowNoise";
    ModeTag2[ModeTag2["LowEnergy"] = 4] = "LowEnergy";
    ModeTag2[ModeTag2["Vacation"] = 5] = "Vacation";
    ModeTag2[ModeTag2["Min"] = 6] = "Min";
    ModeTag2[ModeTag2["Max"] = 7] = "Max";
    ModeTag2[ModeTag2["Night"] = 8] = "Night";
    ModeTag2[ModeTag2["Day"] = 9] = "Day";
    ModeTag2[ModeTag2["Normal"] = 16384] = "Normal";
    ModeTag2[ModeTag2["Delicate"] = 16385] = "Delicate";
    ModeTag2[ModeTag2["Heavy"] = 16386] = "Heavy";
    ModeTag2[ModeTag2["Whites"] = 16387] = "Whites";
  })(ModeTag = LaundryWasherMode2.ModeTag || (LaundryWasherMode2.ModeTag = {}));
  LaundryWasherMode2.TlvModeTagStruct = TlvObject({
    /**
     * If the MfgCode field exists, the Value field shall be in the manufacturer-specific value range (see Section
     * 1.10.8, “Mode Namespace”).
     *
     * This field shall indicate the manufacturer’s VendorID and it shall determine the meaning of the Value field.
     *
     * The same manufacturer code and mode tag value in separate cluster instances are part of the same namespace
     * and have the same meaning. For example: a manufacturer tag meaning "pinch" can be used both in a cluster
     * whose purpose is to choose the amount of sugar, or in a cluster whose purpose is to choose the amount of
     * salt.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.10.5.1.1
     */
    mfgCode: TlvOptionalField(0, TlvVendorId),
    /**
     * This field shall indicate the mode tag within a mode tag namespace which is either manufacturer specific or
     * standard.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.10.5.1.2
     */
    value: TlvField(1, TlvEnum())
  });
  LaundryWasherMode2.TlvModeOption = TlvObject({
    label: TlvField(0, TlvString.bound({ maxLength: 64 })),
    mode: TlvField(1, TlvUInt8),
    modeTags: TlvField(2, TlvArray(LaundryWasherMode2.TlvModeTagStruct, { minLength: 1, maxLength: 8 }))
  });
  LaundryWasherMode2.Base = MutableCluster.Component({
    id: 81,
    name: "LaundryWasherMode",
    revision: 3,
    features: {
      /**
       * Dependency with the OnOff cluster
       */
      onOff: BitFlag(0)
    },
    attributes: {
      /**
       * At least one entry in the SupportedModes attribute shall include the Normal mode tag in the ModeTags
       * field list.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 8.5.6.1
       */
      supportedModes: FixedAttribute(
        0,
        TlvArray(LaundryWasherMode2.TlvModeOption, { minLength: 2, maxLength: 255 }),
        { default: [] }
      ),
      /**
       * @see {@link MatterSpecification.v142.Cluster} § 8.5.6
       */
      currentMode: Attribute(1, TlvUInt8, { persistent: true })
    },
    commands: {
      /**
       * This command is used to change device modes.
       *
       * On receipt of this command the device shall respond with a ChangeToModeResponse command.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.10.7.1
       */
      changeToMode: Command(0, ModeBase.TlvChangeToModeRequest, 1, ModeBase.TlvChangeToModeResponse)
    },
    /**
     * This metadata controls which LaundryWasherModeCluster elements matter.js activates for specific feature
     * combinations.
     */
    extensions: MutableCluster.Extensions({ flags: { onOff: true }, component: false })
  });
  LaundryWasherMode2.ClusterInstance = MutableCluster(LaundryWasherMode2.Base);
  LaundryWasherMode2.Cluster = LaundryWasherMode2.ClusterInstance;
  LaundryWasherMode2.Complete = LaundryWasherMode2.Cluster;
})(LaundryWasherMode || (LaundryWasherMode = {}));
const LaundryWasherModeCluster = LaundryWasherMode.Cluster;
ClusterRegistry.register(LaundryWasherMode.Complete);
export {
  LaundryWasherMode,
  LaundryWasherModeCluster
};
//# sourceMappingURL=laundry-washer-mode.js.map
