/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MutableCluster } from "../cluster/mutation/MutableCluster.js";
import {
  Attribute,
  Command,
  TlvNoResponse,
  OptionalAttribute,
  OptionalWritableAttribute,
  WritableAttribute,
  FixedAttribute,
  OptionalFixedAttribute
} from "../cluster/Cluster.js";
import { TlvUInt8, TlvEnum, TlvUInt16, TlvBitmap, TlvInt16 } from "../tlv/TlvNumber.js";
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
import { BitFlag, BitField } from "../schema/BitmapSchema.js";
import { TlvNullable } from "../tlv/TlvNullable.js";
import { AccessLevel } from "#model";
import { TlvString } from "../tlv/TlvString.js";
import { ClusterRegistry } from "../cluster/ClusterRegistry.js";
var ColorControl;
((ColorControl2) => {
  let Feature;
  ((Feature2) => {
    Feature2["HueSaturation"] = "HueSaturation";
    Feature2["EnhancedHue"] = "EnhancedHue";
    Feature2["ColorLoop"] = "ColorLoop";
    Feature2["Xy"] = "Xy";
    Feature2["ColorTemperature"] = "ColorTemperature";
  })(Feature = ColorControl2.Feature || (ColorControl2.Feature = {}));
  let Direction;
  ((Direction2) => {
    Direction2[Direction2["ShortestDistance"] = 0] = "ShortestDistance";
    Direction2[Direction2["LongestDistance"] = 1] = "LongestDistance";
    Direction2[Direction2["Up"] = 2] = "Up";
    Direction2[Direction2["Down"] = 3] = "Down";
  })(Direction = ColorControl2.Direction || (ColorControl2.Direction = {}));
  ColorControl2.Options = { executeIfOff: BitFlag(0) };
  ColorControl2.TlvMoveToHueRequest = TlvObject({
    /**
     * The Hue field specifies the hue to be moved to.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.4.1
     */
    hue: TlvField(0, TlvUInt8.bound({ max: 254 })),
    /**
     * The Direction field shall be one of the non-reserved values in Values of the Direction Field.
     *
     * ### Table 17. Values of the Direction Field
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.4.2
     */
    direction: TlvField(1, TlvEnum()),
    /**
     * The TransitionTime field specifies, in 1/10ths of a second, the time that shall be taken to move to the new
     * hue.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.4.3
     */
    transitionTime: TlvField(2, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  let MoveMode;
  ((MoveMode2) => {
    MoveMode2[MoveMode2["Stop"] = 0] = "Stop";
    MoveMode2[MoveMode2["Up"] = 1] = "Up";
    MoveMode2[MoveMode2["Down"] = 3] = "Down";
  })(MoveMode = ColorControl2.MoveMode || (ColorControl2.MoveMode = {}));
  ColorControl2.TlvMoveHueRequest = TlvObject({
    /**
     * The MoveMode field shall be one of the non-reserved values in Values of the MoveMode Field. If the MoveMode
     * field is equal to 0 (Stop), the Rate field shall be ignored.
     *
     * ### Table 18. Values of the MoveMode Field
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.5.1
     */
    moveMode: TlvField(0, TlvEnum()),
    /**
     * The Rate field specifies the rate of movement in steps per second. A step is a change in the device’s hue of
     * one unit. If the MoveMode field is set to 1 (up) or 3 (down) and the Rate field has a value of zero, the
     * command has no effect and a response command shall be sent in response, with the status code set to
     * INVALID_COMMAND. If the MoveMode field is set to 0 (stop) the Rate field shall be ignored.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.5.2
     */
    rate: TlvField(1, TlvUInt8),
    optionsMask: TlvField(2, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  let StepMode;
  ((StepMode2) => {
    StepMode2[StepMode2["Up"] = 1] = "Up";
    StepMode2[StepMode2["Down"] = 3] = "Down";
  })(StepMode = ColorControl2.StepMode || (ColorControl2.StepMode = {}));
  ColorControl2.TlvStepHueRequest = TlvObject({
    /**
     * The StepMode field shall be one of the non-reserved values in Values of the StepMode Field.
     *
     * ### Table 20. Values of the StepMode Field
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.6.1
     */
    stepMode: TlvField(0, TlvEnum()),
    /**
     * The change to be added to (or subtracted from) the current value of the device’s hue.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.6.2
     */
    stepSize: TlvField(1, TlvUInt8),
    /**
     * The TransitionTime field specifies, in 1/10ths of a second, the time that shall be taken to perform the
     * step. A step is a change in the device’s hue of ‘Step size’ units.
     *
     * NOTE
     *
     * Here the TransitionTime data field is of data type uint8, where uint16 is more common for TransitionTime
     * data fields in other clusters / commands.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.6.3
     */
    transitionTime: TlvField(2, TlvUInt8),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvMoveToSaturationRequest = TlvObject({
    saturation: TlvField(0, TlvUInt8.bound({ max: 254 })),
    transitionTime: TlvField(1, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(2, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvMoveSaturationRequest = TlvObject({
    /**
     * The MoveMode field shall be one of the non-reserved values in Values of the MoveMode Field. If the MoveMode
     * field is equal to 0 (Stop), the Rate field shall be ignored.
     *
     * ### Table 22. Values of the MoveMode Field
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.8.1
     */
    moveMode: TlvField(0, TlvEnum()),
    /**
     * The Rate field specifies the rate of movement in steps per second. A step is a change in the device’s
     * saturation of one unit. If the MoveMode field is set to 1 (up) or 3 (down) and the Rate field has a value of
     * zero, the command has no effect and a response command shall be sent in response, with the status code set
     * to INVALID_COMMAND. If the MoveMode field is set to 0 (stop) the Rate field shall be ignored.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.8.2
     */
    rate: TlvField(1, TlvUInt8),
    optionsMask: TlvField(2, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvStepSaturationRequest = TlvObject({
    /**
     * The StepMode field shall be one of the non-reserved values in Values of the StepMode Field.
     *
     * ### Table 24. Values of the StepMode Field
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.9.1
     */
    stepMode: TlvField(0, TlvEnum()),
    /**
     * The change to be added to (or subtracted from) the current value of the device’s saturation.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.9.2
     */
    stepSize: TlvField(1, TlvUInt8),
    /**
     * The TransitionTime field specifies, in 1/10ths of a second, the time that shall be taken to perform the
     * step. A step is a change in the device’s saturation of ‘Step size’ units.
     *
     * NOTE
     *
     * Here the TransitionTime data field is of data type uint8, where uint16 is more common for TransitionTime
     * data fields in other clusters / commands.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.9.3
     */
    transitionTime: TlvField(2, TlvUInt8),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvMoveToHueAndSaturationRequest = TlvObject({
    hue: TlvField(0, TlvUInt8.bound({ max: 254 })),
    saturation: TlvField(1, TlvUInt8.bound({ max: 254 })),
    transitionTime: TlvField(2, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvMoveToColorRequest = TlvObject({
    colorX: TlvField(0, TlvUInt16.bound({ max: 65279 })),
    colorY: TlvField(1, TlvUInt16.bound({ max: 65279 })),
    transitionTime: TlvField(2, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvMoveColorRequest = TlvObject({
    /**
     * The RateX field specifies the rate of movement in steps per second. A step is a change in the device’s
     * CurrentX attribute of one unit.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.12.1
     */
    rateX: TlvField(0, TlvInt16),
    /**
     * The RateY field specifies the rate of movement in steps per second. A step is a change in the device’s
     * CurrentY attribute of one unit.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.12.2
     */
    rateY: TlvField(1, TlvInt16),
    optionsMask: TlvField(2, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvStepColorRequest = TlvObject({
    stepX: TlvField(0, TlvInt16),
    stepY: TlvField(1, TlvInt16),
    /**
     * The TransitionTime field specifies, in 1/10ths of a second, the time that shall be taken to perform the
     * color change.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.13.2
     */
    transitionTime: TlvField(2, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvMoveToColorTemperatureRequest = TlvObject({
    colorTemperatureMireds: TlvField(0, TlvUInt16.bound({ max: 65279 })),
    transitionTime: TlvField(1, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(2, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvMoveColorTemperatureRequest = TlvObject({
    /**
     * This field is identical to the MoveMode field of the MoveHue command of the Color Control cluster (see
     * sub-clause MoveHue Command). If the MoveMode field is equal to 0 (Stop), the Rate field shall be ignored.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.21.1
     */
    moveMode: TlvField(0, TlvEnum()),
    /**
     * The Rate field specifies the rate of movement in steps per second. A step is a change in the color
     * temperature of a device by one unit. If the MoveMode field is set to 1 (up) or 3 (down) and the Rate field
     * has a value of zero, the command has no effect and a response command shall be sent in response, with the
     * status code set to INVALID_COMMAND. If the MoveMode field is set to 0 (stop) the Rate field shall be ignored.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.21.2
     */
    rate: TlvField(1, TlvUInt16),
    /**
     * The ColorTemperatureMinimumMireds field specifies a lower bound on the ColorTemperatureMireds attribute (≡
     * an upper bound on the color temperature in kelvins) for the current move operation
     *
     * ColorTempPhysicalMinMireds <= ColorTemperatureMinimumMireds field <= ColorTemperatureMireds
     *
     * As such if the move operation takes the ColorTemperatureMireds attribute towards the value of the
     * ColorTemperatureMinimumMireds field it shall be clipped so that the above invariant is satisfied. If the
     * ColorTemperatureMinimumMireds field is set to 0, ColorTempPhysicalMinMireds shall be used as the lower bound
     * for the ColorTemperatureMireds attribute.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.21.3
     */
    colorTemperatureMinimumMireds: TlvField(2, TlvUInt16.bound({ max: 65279 })),
    /**
     * The ColorTemperatureMaximumMireds field specifies an upper bound on the ColorTemperatureMireds attribute (≡
     * a lower bound on the color temperature in kelvins) for the current move operation
     *
     * ColorTemperatureMireds <= ColorTemperatureMaximumMireds field <= ColorTempPhysicalMaxMireds
     *
     * As such if the move operation takes the ColorTemperatureMireds attribute towards the value of the
     * ColorTemperatureMaximumMireds field it shall be clipped so that the above invariant is satisfied. If the
     * ColorTemperatureMaximumMireds field is set to 0, ColorTempPhysicalMaxMireds shall be used as the upper bound
     * for the ColorTemperatureMireds attribute.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.21.4
     */
    colorTemperatureMaximumMireds: TlvField(3, TlvUInt16.bound({ max: 65279 })),
    optionsMask: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(5, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvStepColorTemperatureRequest = TlvObject({
    /**
     * This field is identical to the StepMode field of the StepHue command of the Color Control cluster (see
     * sub-clause StepHue Command).
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.22.1
     */
    stepMode: TlvField(0, TlvEnum()),
    /**
     * The StepSize field specifies the change to be added to (or subtracted from) the current value of the
     * device’s color temperature.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.22.2
     */
    stepSize: TlvField(1, TlvUInt16),
    /**
     * The TransitionTime field specifies, in units of 1/10ths of a second, the time that shall be taken to perform
     * the step. A step is a change to the device’s color temperature of a magnitude corresponding to the StepSize
     * field.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.22.3
     */
    transitionTime: TlvField(2, TlvUInt16.bound({ max: 65534 })),
    /**
     * The ColorTemperatureMinimumMireds field specifies a lower bound on the ColorTemperatureMireds attribute (≡
     * an upper bound on the color temperature in kelvins) for the current step operation
     *
     * ColorTempPhysicalMinMireds <= ColorTemperatureMinimumMireds field <= ColorTemperatureMireds
     *
     * As such if the step operation takes the ColorTemperatureMireds attribute towards the value of the Color
     * Temperature Minimum Mireds field it shall be clipped so that the above invariant is satisfied. If the
     * ColorTemperatureMinimumMireds field is set to 0, ColorTempPhysicalMinMireds shall be used as the lower bound
     * for the ColorTemperatureMireds attribute.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.22.4
     */
    colorTemperatureMinimumMireds: TlvField(3, TlvUInt16.bound({ max: 65279 })),
    /**
     * The ColorTemperatureMaximumMireds field specifies an upper bound on the ColorTemperatureMireds attribute (≡
     * a lower bound on the color temperature in kelvins) for the current step operation
     *
     * ColorTemperatureMireds ≤ ColorTemperatureMaximumMireds field ≤ ColorTempPhysicalMaxMireds
     *
     * As such if the step operation takes the ColorTemperatureMireds attribute towards the value of the
     * ColorTemperatureMaximumMireds field it shall be clipped so that the above invariant is satisfied. If the
     * ColorTemperatureMaximum Mireds field is set to 0, ColorTempPhysicalMaxMireds shall be used as the upper
     * bound for the ColorTemperatureMireds attribute.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.22.5
     */
    colorTemperatureMaximumMireds: TlvField(4, TlvUInt16.bound({ max: 65279 })),
    optionsMask: TlvField(5, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(6, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvEnhancedMoveToHueRequest = TlvObject({
    /**
     * The EnhancedHue field specifies the target extended hue for the lamp.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.15.1
     */
    enhancedHue: TlvField(0, TlvUInt16),
    /**
     * This field is identical to the Direction field of the MoveToHue command of the Color Control cluster (see
     * sub-clause Use of the OptionsMask and OptionsOverride fields).
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.15.2
     */
    direction: TlvField(1, TlvEnum()),
    /**
     * This field is identical to the TransitionTime field of the MoveToHue command of the Color Control cluster
     * (see sub-clause Use of the OptionsMask and OptionsOverride fields).
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.15.3
     */
    transitionTime: TlvField(2, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvEnhancedMoveHueRequest = TlvObject({
    /**
     * This field is identical to the MoveMode field of the MoveHue command of the Color Control cluster (see
     * sub-clause MoveHue Command). If the MoveMode field is equal to 0 (Stop), the Rate field shall be ignored.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.16.1
     */
    moveMode: TlvField(0, TlvEnum()),
    /**
     * The Rate field specifies the rate of movement in steps per second. A step is a change in the extended hue of
     * a device by one unit. If the MoveMode field is set to 1 (up) or 3 (down) and the Rate field has a value of
     * zero, the command has no effect and a response command shall be sent in response, with the status code set
     * to INVALID_COMMAND. If the MoveMode field is set to 0 (stop) the Rate field shall be ignored.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.16.2
     */
    rate: TlvField(1, TlvUInt16),
    optionsMask: TlvField(2, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvEnhancedStepHueRequest = TlvObject({
    /**
     * This field is identical to the StepMode field of the StepHue command of the Color Control cluster (see
     * sub-clause StepHue Command).
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.17.1
     */
    stepMode: TlvField(0, TlvEnum()),
    /**
     * The StepSize field specifies the change to be added to (or subtracted from) the current value of the
     * device’s enhanced hue.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.17.2
     */
    stepSize: TlvField(1, TlvUInt16),
    /**
     * The TransitionTime field specifies, in units of 1/10ths of a second, the time that shall be taken to perform
     * the step. A step is a change to the device’s enhanced hue of a magnitude corresponding to the StepSize field.
     *
     * NOTE
     *
     * Here TransitionTime data field is of data type uint16, while the TransitionTime data field of the StepHue
     * command is of data type uint8.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.17.3
     */
    transitionTime: TlvField(2, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvEnhancedMoveToHueAndSaturationRequest = TlvObject({
    /**
     * The EnhancedHue field specifies the target extended hue for the lamp.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.18.1
     */
    enhancedHue: TlvField(0, TlvUInt16),
    /**
     * This field is identical to the Saturation field of the MoveToHueAndSaturation command of the Color Control
     * cluster (see sub-clause MoveToHueAndSaturation Command).
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.18.2
     */
    saturation: TlvField(1, TlvUInt8.bound({ max: 254 })),
    /**
     * This field is identical to the TransitionTime field of the MoveToHue command of the Color Control cluster
     * (see sub-clause MoveToHueAndSaturation Command).
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.18.3
     */
    transitionTime: TlvField(2, TlvUInt16.bound({ max: 65534 })),
    optionsMask: TlvField(3, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(4, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  let ColorLoopActive;
  ((ColorLoopActive2) => {
    ColorLoopActive2[ColorLoopActive2["Inactive"] = 0] = "Inactive";
    ColorLoopActive2[ColorLoopActive2["Active"] = 1] = "Active";
  })(ColorLoopActive = ColorControl2.ColorLoopActive || (ColorControl2.ColorLoopActive = {}));
  let ColorLoopDirection;
  ((ColorLoopDirection2) => {
    ColorLoopDirection2[ColorLoopDirection2["Decrement"] = 0] = "Decrement";
    ColorLoopDirection2[ColorLoopDirection2["Increment"] = 1] = "Increment";
  })(ColorLoopDirection = ColorControl2.ColorLoopDirection || (ColorControl2.ColorLoopDirection = {}));
  ColorControl2.UpdateFlags = {
    updateAction: BitFlag(0),
    updateDirection: BitFlag(1),
    updateTime: BitFlag(2),
    updateStartHue: BitFlag(3),
    reserved: BitField(4, 4)
  };
  let Action;
  ((Action2) => {
    Action2[Action2["DeActivateTheColorLoop"] = 0] = "DeActivateTheColorLoop";
    Action2[Action2["ActivateTheColorLoopFromTheValueInTheColorLoopStartEnhancedHueField"] = 1] = "ActivateTheColorLoopFromTheValueInTheColorLoopStartEnhancedHueField";
    Action2[Action2["ActivateTheColorLoopFromTheValueOfTheEnhancedCurrentHueAttribute"] = 2] = "ActivateTheColorLoopFromTheValueOfTheEnhancedCurrentHueAttribute";
  })(Action = ColorControl2.Action || (ColorControl2.Action = {}));
  let ColorLoopSetDirection;
  ((ColorLoopSetDirection2) => {
    ColorLoopSetDirection2[ColorLoopSetDirection2["DecrementTheHueInTheColorLoop"] = 0] = "DecrementTheHueInTheColorLoop";
    ColorLoopSetDirection2[ColorLoopSetDirection2["IncrementTheHueInTheColorLoop"] = 1] = "IncrementTheHueInTheColorLoop";
  })(ColorLoopSetDirection = ColorControl2.ColorLoopSetDirection || (ColorControl2.ColorLoopSetDirection = {}));
  ColorControl2.TlvColorLoopSetRequest = TlvObject({
    /**
     * The UpdateFlags field specifies which color loop attributes to update before the color loop is started. This
     * field shall be formatted as illustrated in Format of the UpdateFlags Field of the ColorLoopSet Command.
     *
     * ### Table 28. Format of the UpdateFlags Field of the ColorLoopSet Command
     *
     * The UpdateAction sub-field is 1 bit in length and specifies whether the device shall adhere to the action
     * field in order to process the command. If this sub-field is set to 1, the device shall adhere to the action
     * field. If this sub-field is set to 0, the device shall ignore the Action field.
     *
     * The UpdateDirection sub-field is 1 bit in length and specifies whether the device shall update the
     * ColorLoopDirection attribute with the Direction field. If this sub-field is set to 1, the device shall
     * update the value of the ColorLoopDirection attribute with the value of the Direction field. If this
     * sub-field is set to 0, the device shall ignore the Direction field.
     *
     * The UpdateTime sub-field is 1 bit in length and specifies whether the device shall update the ColorLoopTime
     * attribute with the Time field. If this sub-field is set to 1, the device shall update the value of the
     * ColorLoopTime attribute with the value of the Time field. If this sub-field is set to 0, the device shall
     * ignore the Time field.
     *
     * The UpdateStartHue sub-field is 1 bit in length and specifies whether the device shall update the
     * ColorLoopStartEnhancedHue attribute with the StartHue field. If this sub-field is set to 1, the device shall
     * update the value of the ColorLoopStartEnhancedHue attribute with the value of the StartHue field. If this
     * sub-field is set to 0, the device shall ignore the StartHue field.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.19.1
     */
    updateFlags: TlvField(0, TlvBitmap(TlvUInt8, ColorControl2.UpdateFlags)),
    /**
     * The Action field specifies the action to take for the color loop if the UpdateAction sub-field of the
     * UpdateFlags field is set to 1. This field shall be set to one of the non-reserved values listed in Values of
     * the Action Field of the ColorLoopSet Command.
     *
     * ### Table 29. Values of the Action Field of the ColorLoopSet Command
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.19.2
     */
    action: TlvField(1, TlvEnum()),
    /**
     * The Direction field specifies the direction for the color loop if the Update Direction field of the
     * UpdateFlags field is set to 1. This field shall be set to one of the non-reserved values listed in Values of
     * the Direction Field of the ColorLoopSet Command.
     *
     * ### Table 30. Values of the Direction Field of the ColorLoopSet Command
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.19.3
     */
    direction: TlvField(2, TlvEnum()),
    /**
     * The Time field specifies the number of seconds over which to perform a full color loop if the UpdateTime
     * sub-field of the UpdateFlags field is set to 1.
     *
     * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.19.4
     */
    time: TlvField(3, TlvUInt16),
    startHue: TlvField(4, TlvUInt16),
    optionsMask: TlvField(5, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(6, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  ColorControl2.TlvStopMoveStepRequest = TlvObject({
    optionsMask: TlvField(0, TlvBitmap(TlvUInt8, ColorControl2.Options)),
    optionsOverride: TlvField(1, TlvBitmap(TlvUInt8, ColorControl2.Options))
  });
  let DriftCompensation;
  ((DriftCompensation2) => {
    DriftCompensation2[DriftCompensation2["None"] = 0] = "None";
    DriftCompensation2[DriftCompensation2["OtherUnknown"] = 1] = "OtherUnknown";
    DriftCompensation2[DriftCompensation2["TemperatureMonitoring"] = 2] = "TemperatureMonitoring";
    DriftCompensation2[DriftCompensation2["OpticalLuminanceMonitoringAndFeedback"] = 3] = "OpticalLuminanceMonitoringAndFeedback";
    DriftCompensation2[DriftCompensation2["OpticalColorMonitoringAndFeedback"] = 4] = "OpticalColorMonitoringAndFeedback";
  })(DriftCompensation = ColorControl2.DriftCompensation || (ColorControl2.DriftCompensation = {}));
  let ColorMode;
  ((ColorMode2) => {
    ColorMode2[ColorMode2["CurrentHueAndCurrentSaturation"] = 0] = "CurrentHueAndCurrentSaturation";
    ColorMode2[ColorMode2["CurrentXAndCurrentY"] = 1] = "CurrentXAndCurrentY";
    ColorMode2[ColorMode2["ColorTemperatureMireds"] = 2] = "ColorTemperatureMireds";
  })(ColorMode = ColorControl2.ColorMode || (ColorControl2.ColorMode = {}));
  let EnhancedColorMode;
  ((EnhancedColorMode2) => {
    EnhancedColorMode2[EnhancedColorMode2["CurrentHueAndCurrentSaturation"] = 0] = "CurrentHueAndCurrentSaturation";
    EnhancedColorMode2[EnhancedColorMode2["CurrentXAndCurrentY"] = 1] = "CurrentXAndCurrentY";
    EnhancedColorMode2[EnhancedColorMode2["ColorTemperatureMireds"] = 2] = "ColorTemperatureMireds";
    EnhancedColorMode2[EnhancedColorMode2["EnhancedCurrentHueAndCurrentSaturation"] = 3] = "EnhancedCurrentHueAndCurrentSaturation";
  })(EnhancedColorMode = ColorControl2.EnhancedColorMode || (ColorControl2.EnhancedColorMode = {}));
  ColorControl2.ColorCapabilities = {
    hueSaturation: BitFlag(0),
    enhancedHue: BitFlag(1),
    colorLoop: BitFlag(2),
    xy: BitFlag(3),
    colorTemperature: BitFlag(4)
  };
  ColorControl2.HueSaturationComponent = MutableCluster.Component({
    attributes: {
      /**
       * The CurrentHue attribute contains the current hue value of the light. It is updated as fast as practical
       * during commands that change the hue.
       *
       * The hue in degrees shall be related to the CurrentHue attribute by the relationship: Hue = CurrentHue x
       * 360 / 254 (CurrentHue in the range 0 to 254 inclusive)
       *
       * If this attribute is implemented then the CurrentSaturation and ColorMode attributes shall also be
       * implemented.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.2
       */
      currentHue: Attribute(0, TlvUInt8.bound({ max: 254 }), { persistent: true, default: 0 }),
      /**
       * The CurrentSaturation attribute holds the current saturation value of the light. It is updated as fast
       * as practical during commands that change the saturation.
       *
       * The saturation shall be related to the CurrentSaturation attribute by the relationship: Saturation =
       * CurrentSaturation/254 (CurrentSaturation in the range 0 to 254 inclusive)
       *
       * If this attribute is implemented then the CurrentHue and ColorMode attributes shall also be implemented.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.3
       */
      currentSaturation: Attribute(
        1,
        TlvUInt8.bound({ max: 254 }),
        { scene: true, persistent: true, default: 0 }
      )
    },
    commands: {
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.4
       */
      moveToHue: Command(0, ColorControl2.TlvMoveToHueRequest, 0, TlvNoResponse),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.5
       */
      moveHue: Command(1, ColorControl2.TlvMoveHueRequest, 1, TlvNoResponse),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.6
       */
      stepHue: Command(2, ColorControl2.TlvStepHueRequest, 2, TlvNoResponse),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.7
       */
      moveToSaturation: Command(3, ColorControl2.TlvMoveToSaturationRequest, 3, TlvNoResponse),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.8
       */
      moveSaturation: Command(4, ColorControl2.TlvMoveSaturationRequest, 4, TlvNoResponse),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.9
       */
      stepSaturation: Command(5, ColorControl2.TlvStepSaturationRequest, 5, TlvNoResponse),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.10
       */
      moveToHueAndSaturation: Command(6, ColorControl2.TlvMoveToHueAndSaturationRequest, 6, TlvNoResponse)
    }
  });
  ColorControl2.XyComponent = MutableCluster.Component({
    attributes: {
      /**
       * The CurrentX attribute contains the current value of the normalized chromaticity value x, as defined in
       * the CIE xyY Color Space. It is updated as fast as practical during commands that change the color.
       *
       * The value of x shall be related to the CurrentX attribute by the relationship x = CurrentX / 65536
       * (CurrentX in the range 0 to 65279 inclusive)
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.5
       */
      currentX: Attribute(
        3,
        TlvUInt16.bound({ max: 65279 }),
        { scene: true, persistent: true, default: 24939 }
      ),
      /**
       * The CurrentY attribute contains the current value of the normalized chromaticity value y, as defined in
       * the CIE xyY Color Space. It is updated as fast as practical during commands that change the color.
       *
       * The value of y shall be related to the CurrentY attribute by the relationship y = CurrentY / 65536
       * (CurrentY in the range 0 to 65279 inclusive)
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.6
       */
      currentY: Attribute(
        4,
        TlvUInt16.bound({ max: 65279 }),
        { scene: true, persistent: true, default: 24701 }
      )
    },
    commands: {
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.11
       */
      moveToColor: Command(7, ColorControl2.TlvMoveToColorRequest, 7, TlvNoResponse),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.12
       */
      moveColor: Command(8, ColorControl2.TlvMoveColorRequest, 8, TlvNoResponse),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.13
       */
      stepColor: Command(9, ColorControl2.TlvStepColorRequest, 9, TlvNoResponse)
    }
  });
  ColorControl2.ColorTemperatureComponent = MutableCluster.Component({
    attributes: {
      /**
       * The ColorTemperatureMireds attribute contains a scaled inverse of the current value of the color
       * temperature. The unit of ColorTemperatureMireds is the mired (micro reciprocal degree), a.k.a. mirek
       * (micro reciprocal kelvin). It is updated as fast as practical during commands that change the color.
       *
       * The color temperature value in kelvins shall be related to the ColorTemperatureMireds attribute in
       * mireds by the relationship
       *
       * Color temperature in kelvins = 1,000,000 / ColorTemperatureMireds, where ColorTemperatureMireds is in
       * the range 1 to 65279 mireds inclusive, giving a color temperature range from 1,000,000 kelvins to 15.32
       * kelvins.
       *
       * If this attribute is implemented then the ColorMode attribute shall also be implemented.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.9
       */
      colorTemperatureMireds: Attribute(7, TlvUInt16, { scene: true, persistent: true, default: 250 }),
      /**
       * The ColorTempPhysicalMinMireds attribute indicates the minimum mired value supported by the hardware.
       * ColorTempPhysicalMinMireds corresponds to the maximum color temperature in kelvins supported by the
       * hardware. ColorTempPhysicalMinMireds <= ColorTemperatureMireds.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.20
       */
      colorTempPhysicalMinMireds: Attribute(16395, TlvUInt16.bound({ max: 65279 }), { default: 0 }),
      /**
       * The ColorTempPhysicalMaxMireds attribute indicates the maximum mired value supported by the hardware.
       * ColorTempPhysicalMaxMireds corresponds to the minimum color temperature in kelvins supported by the
       * hardware. ColorTemperatureMireds <= ColorTempPhysicalMaxMireds.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.21
       */
      colorTempPhysicalMaxMireds: Attribute(16396, TlvUInt16.bound({ max: 65279 }), { default: 65279 }),
      /**
       * The CoupleColorTempToLevelMinMireds attribute specifies a lower bound on the value of the
       * ColorTemperatureMireds attribute for the purposes of coupling the ColorTemperatureMireds attribute to
       * the CurrentLevel attribute when the CoupleColorTempToLevel bit of the Options attribute of the Level
       * Control cluster is equal to 1. When coupling the ColorTemperatureMireds attribute to the CurrentLevel
       * attribute, this value shall correspond to a CurrentLevel value of 0xFE (100%).
       *
       * This attribute shall be set such that the following relationship exists: ColorTempPhysicalMinMireds ≤
       * CoupleColorTempToLevelMinMireds ≤ ColorTemperatureMireds
       *
       * Note that since this attribute is stored as a micro reciprocal degree (mired) value (i.e. color
       * temperature in kelvins = 1,000,000 / CoupleColorTempToLevelMinMireds), the
       * CoupleColorTempToLevelMinMireds attribute corresponds to an upper bound on the value of the color
       * temperature in kelvins supported by the device.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.22
       */
      coupleColorTempToLevelMinMireds: OptionalAttribute(16397, TlvUInt16),
      /**
       * The StartUpColorTemperatureMireds attribute shall define the desired startup color temperature value a
       * lamp shall use when it is supplied with power and this value shall be reflected in the
       * ColorTemperatureMireds attribute. In addition, the ColorMode and EnhancedColorMode attributes shall be
       * set to 0x02 (color temperature). The values of the StartUpColorTemperatureMireds attribute are listed in
       * the table below,
       *
       * Table 12. Values of the StartUpColorTemperatureMireds attribute
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.23
       */
      startUpColorTemperatureMireds: OptionalWritableAttribute(
        16400,
        TlvNullable(TlvUInt16.bound({ max: 65279 })),
        { persistent: true, writeAcl: AccessLevel.Manage }
      )
    },
    commands: {
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.14
       */
      moveToColorTemperature: Command(10, ColorControl2.TlvMoveToColorTemperatureRequest, 10, TlvNoResponse),
      /**
       * The MoveColorTemperature command allows the color temperature of a lamp to be moved at a specified rate.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.21
       */
      moveColorTemperature: Command(75, ColorControl2.TlvMoveColorTemperatureRequest, 75, TlvNoResponse),
      /**
       * The StepColorTemperature command allows the color temperature of a lamp to be stepped with a specified
       * step size.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.22
       */
      stepColorTemperature: Command(76, ColorControl2.TlvStepColorTemperatureRequest, 76, TlvNoResponse)
    }
  });
  ColorControl2.EnhancedHueComponent = MutableCluster.Component({
    attributes: {
      /**
       * The EnhancedCurrentHue attribute represents non-equidistant steps along the CIE 1931 color triangle, and
       * it provides 16-bits precision.
       *
       * The upper 8 bits of this attribute shall be used as an index in the implementation specific XY lookup
       * table to provide the non-equidistance steps. The lower 8 bits shall be used to interpolate between these
       * steps in a linear way in order to provide color zoom for the user.
       *
       * To provide compatibility with standard ZCL, the CurrentHue attribute shall contain a hue value in the
       * range 0 to 254, calculated from the EnhancedCurrentHue attribute.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.12
       */
      enhancedCurrentHue: Attribute(16384, TlvUInt16, { scene: true, persistent: true, default: 0 })
    },
    commands: {
      /**
       * The EnhancedMoveToHue command allows lamps to be moved in a smooth continuous transition from their
       * current hue to a target hue.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.15
       */
      enhancedMoveToHue: Command(64, ColorControl2.TlvEnhancedMoveToHueRequest, 64, TlvNoResponse),
      /**
       * The EnhancedMoveHue command allows lamps to be moved in a continuous stepped transition from their
       * current hue to a target hue.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.16
       */
      enhancedMoveHue: Command(65, ColorControl2.TlvEnhancedMoveHueRequest, 65, TlvNoResponse),
      /**
       * The EnhancedStepHue command allows lamps to be moved in a stepped transition from their current hue to a
       * target hue, resulting in a linear transition through XY space.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.17
       */
      enhancedStepHue: Command(66, ColorControl2.TlvEnhancedStepHueRequest, 66, TlvNoResponse),
      /**
       * The EnhancedMoveToHueAndSaturation command allows lamps to be moved in a smooth continuous transition
       * from their current hue to a target hue and from their current saturation to a target saturation.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.18
       */
      enhancedMoveToHueAndSaturation: Command(
        67,
        ColorControl2.TlvEnhancedMoveToHueAndSaturationRequest,
        67,
        TlvNoResponse
      )
    }
  });
  ColorControl2.ColorLoopComponent = MutableCluster.Component({
    attributes: {
      /**
       * The ColorLoopActive attribute specifies the current active status of the color loop. If this attribute
       * has the value 0, the color loop shall not be active. If this attribute has the value 1, the color loop
       * shall be active. All other values (2 to 254) are reserved.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.14
       */
      colorLoopActive: Attribute(
        16386,
        TlvEnum(),
        { scene: true, persistent: true, default: 0 /* Inactive */ }
      ),
      /**
       * The ColorLoopDirection attribute specifies the current direction of the color loop. If this attribute
       * has the value 0, the EnhancedCurrentHue attribute shall be decremented. If this attribute has the value
       * 1, the EnhancedCurrentHue attribute shall be incremented. All other values (2 to 254) are reserved.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.15
       */
      colorLoopDirection: Attribute(
        16387,
        TlvEnum(),
        { scene: true, persistent: true, default: 0 /* Decrement */ }
      ),
      /**
       * The ColorLoopTime attribute specifies the number of seconds it shall take to perform a full color loop,
       * i.e., to cycle all values of the EnhancedCurrentHue attribute (between 0 and 0xFFFE).
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.16
       */
      colorLoopTime: Attribute(16388, TlvUInt16, { scene: true, persistent: true, default: 25 }),
      /**
       * The ColorLoopStartEnhancedHue attribute specifies the value of the EnhancedCurrentHue attribute from
       * which the color loop shall be started.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.17
       */
      colorLoopStartEnhancedHue: Attribute(16389, TlvUInt16, { default: 8960 }),
      /**
       * The ColorLoopStoredEnhancedHue attribute specifies the value of the EnhancedCurrentHue attribute before
       * the color loop was started. Once the color loop is complete, the EnhancedCurrentHue attribute shall be
       * restored to this value.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.18
       */
      colorLoopStoredEnhancedHue: Attribute(16390, TlvUInt16, { default: 0 })
    },
    commands: {
      /**
       * The Color Loop Set command allows a color loop to be activated such that the color lamp cycles through
       * its range of hues.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.19
       */
      colorLoopSet: Command(68, ColorControl2.TlvColorLoopSetRequest, 68, TlvNoResponse)
    }
  });
  ColorControl2.HueSaturationOrXyOrColorTemperatureComponent = MutableCluster.Component({
    commands: {
      /**
       * The StopMoveStep command is provided to allow MoveTo and Step commands to be stopped. (Note this
       * automatically provides symmetry to the Level Control cluster.)
       *
       * NOTE the StopMoveStep command has no effect on an active color loop.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.11.20
       */
      stopMoveStep: Command(71, ColorControl2.TlvStopMoveStepRequest, 71, TlvNoResponse)
    }
  });
  ColorControl2.Base = MutableCluster.Component({
    id: 768,
    name: "ColorControl",
    revision: 6,
    features: {
      /**
       * HueSaturation
       *
       * Supports color specification via hue/saturation.
       */
      hueSaturation: BitFlag(0),
      /**
       * EnhancedHue
       *
       * Enhanced hue is supported.
       */
      enhancedHue: BitFlag(1),
      /**
       * ColorLoop
       *
       * Color loop is supported.
       */
      colorLoop: BitFlag(2),
      /**
       * Xy
       *
       * Supports color specification via XY.
       */
      xy: BitFlag(3),
      /**
       * ColorTemperature
       *
       * Supports specification of color temperature.
       */
      colorTemperature: BitFlag(4)
    },
    attributes: {
      /**
       * The RemainingTime attribute holds the time remaining, in 1/10ths of a second, until the currently active
       * command will be complete.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.4
       */
      remainingTime: OptionalAttribute(2, TlvUInt16, { default: 0 }),
      /**
       * The DriftCompensation attribute indicates what mechanism, if any, is in use for compensation for
       * color/intensity drift over time. It shall be one of the non-reserved values in Values of the
       * DriftCompensation Attribute.
       *
       * ### Table 8. Values of the DriftCompensation Attribute
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.7
       */
      driftCompensation: OptionalAttribute(5, TlvEnum()),
      /**
       * The CompensationText attribute holds a textual indication of what mechanism, if any, is in use to
       * compensate for color/intensity drift over time.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.8
       */
      compensationText: OptionalAttribute(6, TlvString.bound({ maxLength: 254 })),
      /**
       * The ColorMode attribute indicates which attributes are currently determining the color of the device.
       *
       * The value of the ColorMode attribute cannot be written directly - it is set upon reception of any
       * command in section Commands to the appropriate mode for that command.
       *
       * Table 9. Values of the ColorMode Attribute
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.10
       */
      colorMode: Attribute(8, TlvEnum(), { persistent: true }),
      /**
       * The Options attribute is meant to be changed only during commissioning. The Options attribute is a
       * bitmap that determines the default behavior of some cluster commands. Each command that is dependent on
       * the Options attribute shall first construct a temporary Options bitmap that is in effect during the
       * command processing. The temporary Options bitmap has the same format and meaning as the Options
       * attribute, but includes any bits that may be overridden by command fields.
       *
       * Below is the format and description of the Options attribute and temporary Options bitmap and the effect
       * on dependent commands.
       *
       * Table 10. Options Attribute
       *
       * ExecuteIfOff Options bit: Command execution shall NOT continue beyond the Options processing if all of
       * these criteria are true:
       *
       *   • The On/Off cluster exists on the same endpoint as this cluster.
       *
       *   • The OnOff attribute of the On/Off cluster, on this endpoint, is FALSE.
       *
       *   • The value of the ExecuteIfOff bit is 0.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.11
       */
      options: WritableAttribute(15, TlvBitmap(TlvUInt8, ColorControl2.Options)),
      /**
       * The NumberOfPrimaries attribute contains the number of color primaries implemented on this device. A
       * value of null shall indicate that the number of primaries is unknown.
       *
       * Where this attribute is implemented, the attributes below for indicating the “x” and “y” color values of
       * the primaries shall also be implemented for each of the primaries from 1 to NumberOfPrimaries, without
       * leaving gaps. Implementation of the Primary1Intensity attribute and subsequent intensity attributes is
       * optional.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8.1
       */
      numberOfPrimaries: FixedAttribute(16, TlvNullable(TlvUInt8.bound({ max: 6 }))),
      /**
       * The Primary1X attribute contains the normalized chromaticity value x for this primary, as defined in the
       * CIE xyY Color Space.
       *
       * The value of x shall be related to the Primary1X attribute by the relationship x = Primary1X / 65536
       * (Primary1X in the range 0 to 65279 inclusive)
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8.2
       */
      primary1X: OptionalFixedAttribute(17, TlvUInt16.bound({ max: 65279 })),
      /**
       * The Primary1Y attribute contains the normalized chromaticity value y for this primary, as defined in the
       * CIE xyY Color Space.
       *
       * The value of y shall be related to the Primary1Y attribute by the relationship y = Primary1Y / 65536
       * (Primary1Y in the range 0 to 65279 inclusive)
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8.3
       */
      primary1Y: OptionalFixedAttribute(18, TlvUInt16.bound({ max: 65279 })),
      /**
       * The Primary1intensity attribute contains a representation of the maximum intensity of this primary as
       * defined in the Dimming Light Curve in the Ballast Configuration cluster (see Ballast Configuration
       * Cluster), normalized such that the primary with the highest maximum intensity contains the value 0xFE.
       *
       * A value of null shall indicate that this primary is not available.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8.4
       */
      primary1Intensity: OptionalFixedAttribute(19, TlvNullable(TlvUInt8)),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8
       */
      primary2X: OptionalFixedAttribute(21, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8
       */
      primary2Y: OptionalFixedAttribute(22, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8
       */
      primary2Intensity: OptionalFixedAttribute(23, TlvNullable(TlvUInt8)),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8
       */
      primary3X: OptionalFixedAttribute(25, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8
       */
      primary3Y: OptionalFixedAttribute(26, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.8
       */
      primary3Intensity: OptionalFixedAttribute(27, TlvNullable(TlvUInt8)),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary4X: OptionalFixedAttribute(32, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary4Y: OptionalFixedAttribute(33, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary4Intensity: OptionalFixedAttribute(34, TlvNullable(TlvUInt8)),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary5X: OptionalFixedAttribute(36, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary5Y: OptionalFixedAttribute(37, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary5Intensity: OptionalFixedAttribute(38, TlvNullable(TlvUInt8)),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary6X: OptionalFixedAttribute(40, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary6Y: OptionalFixedAttribute(41, TlvUInt16.bound({ max: 65279 })),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.9
       */
      primary6Intensity: OptionalFixedAttribute(42, TlvNullable(TlvUInt8)),
      /**
       * The WhitePointX attribute contains the normalized chromaticity value x, as defined in the CIE xyY Color
       * Space, of the current white point of the device.
       *
       * The value of x shall be related to the WhitePointX attribute by the relationship x = WhitePointX / 65536
       * (WhitePointX in the range 0 to 65279 inclusive)
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10.1
       */
      whitePointX: OptionalWritableAttribute(
        48,
        TlvUInt16.bound({ max: 65279 }),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * The WhitePointY attribute contains the normalized chromaticity value y, as defined in the CIE xyY
       *
       * Color Space, of the current white point of the device.
       *
       * The value of y shall be related to the WhitePointY attribute by the relationship y = WhitePointY / 65536
       * (WhitePointY in the range 0 to 65279 inclusive)
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10.2
       */
      whitePointY: OptionalWritableAttribute(
        49,
        TlvUInt16.bound({ max: 65279 }),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * The ColorPointRX attribute contains the normalized chromaticity value x, as defined in the CIE xyY Color
       * Space, of the red color point of the device.
       *
       * The value of x shall be related to the ColorPointRX attribute by the relationship x = ColorPointRX /
       * 65536 (ColorPointRX in the range 0 to 65279 inclusive)
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10.3
       */
      colorPointRx: OptionalWritableAttribute(
        50,
        TlvUInt16.bound({ max: 65279 }),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * The ColorPointRY attribute contains the normalized chromaticity value y, as defined in the CIE xyY Color
       * Space, of the red color point of the device.
       *
       * The value of y shall be related to the ColorPointRY attribute by the relationship y = ColorPointRY /
       * 65536 (ColorPointRY in the range 0 to 65279 inclusive)
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10.4
       */
      colorPointRy: OptionalWritableAttribute(
        51,
        TlvUInt16.bound({ max: 65279 }),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * The ColorPointRIntensity attribute contains a representation of the relative intensity of the red color
       * point as defined in the Dimming Light Curve in the Ballast Configuration cluster (see Ballast
       * Configuration Cluster), normalized such that the color point with the highest relative intensity
       * contains the value 0xFE.
       *
       * A value of null shall indicate an invalid value.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10.5
       */
      colorPointRIntensity: OptionalWritableAttribute(
        52,
        TlvNullable(TlvUInt8),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10
       */
      colorPointGx: OptionalWritableAttribute(
        54,
        TlvUInt16.bound({ max: 65279 }),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10
       */
      colorPointGy: OptionalWritableAttribute(
        55,
        TlvUInt16.bound({ max: 65279 }),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10
       */
      colorPointGIntensity: OptionalWritableAttribute(
        56,
        TlvNullable(TlvUInt8),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10
       */
      colorPointBx: OptionalWritableAttribute(
        58,
        TlvUInt16.bound({ max: 65279 }),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10
       */
      colorPointBy: OptionalWritableAttribute(
        59,
        TlvUInt16.bound({ max: 65279 }),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.10
       */
      colorPointBIntensity: OptionalWritableAttribute(
        60,
        TlvNullable(TlvUInt8),
        { writeAcl: AccessLevel.Manage }
      ),
      /**
       * The EnhancedColorMode attribute specifies which attributes are currently determining the color of the
       * device, as detailed in Values of the EnhancedColorMode Attribute.
       *
       * ### Table 11. Values of the EnhancedColorMode Attribute
       *
       * To provide compatibility with standard ZCL, the original ColorMode attribute shall indicate ‘CurrentHue
       * and CurrentSaturation’ when the light uses the EnhancedCurrentHue attribute. If the ColorMode attribute
       * is changed, e.g., due to one of the standard Color Control cluster commands defined in the ZCL, its new
       * value shall be copied to the EnhancedColorMode attribute.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.13
       */
      enhancedColorMode: Attribute(
        16385,
        TlvEnum(),
        { scene: true, persistent: true, default: 1 /* CurrentXAndCurrentY */ }
      ),
      /**
       * Bits 0-4 of the ColorCapabilities attribute shall have the same values as the corresponding bits of the
       * FeatureMap attribute. All other bits in ColorCapabilities shall be 0.
       *
       * @see {@link MatterSpecification.v13.Cluster} § 3.2.7.19
       */
      colorCapabilities: Attribute(16394, TlvBitmap(TlvUInt16, ColorControl2.ColorCapabilities))
    },
    /**
     * This metadata controls which ColorControlCluster elements matter.js activates for specific feature
     * combinations.
     */
    extensions: MutableCluster.Extensions(
      { flags: { hueSaturation: true }, component: ColorControl2.HueSaturationComponent },
      { flags: { xy: true }, component: ColorControl2.XyComponent },
      { flags: { colorTemperature: true }, component: ColorControl2.ColorTemperatureComponent },
      { flags: { enhancedHue: true }, component: ColorControl2.EnhancedHueComponent },
      { flags: { colorLoop: true }, component: ColorControl2.ColorLoopComponent },
      { flags: { hueSaturation: true }, component: ColorControl2.HueSaturationOrXyOrColorTemperatureComponent },
      { flags: { xy: true }, component: ColorControl2.HueSaturationOrXyOrColorTemperatureComponent },
      { flags: { colorTemperature: true }, component: ColorControl2.HueSaturationOrXyOrColorTemperatureComponent }
    )
  });
  ColorControl2.ClusterInstance = MutableCluster(ColorControl2.Base);
  ColorControl2.Cluster = ColorControl2.ClusterInstance;
  const HS = { hueSaturation: true };
  const XY = { xy: true };
  const CT = { colorTemperature: true };
  const EHUE = { enhancedHue: true };
  const CL = { colorLoop: true };
  ColorControl2.CompleteInstance = MutableCluster({
    id: ColorControl2.Cluster.id,
    name: ColorControl2.Cluster.name,
    revision: ColorControl2.Cluster.revision,
    features: ColorControl2.Cluster.features,
    attributes: {
      ...ColorControl2.Cluster.attributes,
      currentHue: MutableCluster.AsConditional(
        ColorControl2.HueSaturationComponent.attributes.currentHue,
        { mandatoryIf: [HS] }
      ),
      currentSaturation: MutableCluster.AsConditional(
        ColorControl2.HueSaturationComponent.attributes.currentSaturation,
        { mandatoryIf: [HS] }
      ),
      currentX: MutableCluster.AsConditional(ColorControl2.XyComponent.attributes.currentX, { mandatoryIf: [XY] }),
      currentY: MutableCluster.AsConditional(ColorControl2.XyComponent.attributes.currentY, { mandatoryIf: [XY] }),
      colorTemperatureMireds: MutableCluster.AsConditional(
        ColorControl2.ColorTemperatureComponent.attributes.colorTemperatureMireds,
        { mandatoryIf: [CT] }
      ),
      enhancedCurrentHue: MutableCluster.AsConditional(
        ColorControl2.EnhancedHueComponent.attributes.enhancedCurrentHue,
        { mandatoryIf: [EHUE] }
      ),
      colorLoopActive: MutableCluster.AsConditional(
        ColorControl2.ColorLoopComponent.attributes.colorLoopActive,
        { mandatoryIf: [CL] }
      ),
      colorLoopDirection: MutableCluster.AsConditional(
        ColorControl2.ColorLoopComponent.attributes.colorLoopDirection,
        { mandatoryIf: [CL] }
      ),
      colorLoopTime: MutableCluster.AsConditional(
        ColorControl2.ColorLoopComponent.attributes.colorLoopTime,
        { mandatoryIf: [CL] }
      ),
      colorLoopStartEnhancedHue: MutableCluster.AsConditional(
        ColorControl2.ColorLoopComponent.attributes.colorLoopStartEnhancedHue,
        { mandatoryIf: [CL] }
      ),
      colorLoopStoredEnhancedHue: MutableCluster.AsConditional(
        ColorControl2.ColorLoopComponent.attributes.colorLoopStoredEnhancedHue,
        { mandatoryIf: [CL] }
      ),
      colorTempPhysicalMinMireds: MutableCluster.AsConditional(
        ColorControl2.ColorTemperatureComponent.attributes.colorTempPhysicalMinMireds,
        { mandatoryIf: [CT] }
      ),
      colorTempPhysicalMaxMireds: MutableCluster.AsConditional(
        ColorControl2.ColorTemperatureComponent.attributes.colorTempPhysicalMaxMireds,
        { mandatoryIf: [CT] }
      ),
      coupleColorTempToLevelMinMireds: MutableCluster.AsConditional(
        ColorControl2.ColorTemperatureComponent.attributes.coupleColorTempToLevelMinMireds,
        { optionalIf: [CT] }
      ),
      startUpColorTemperatureMireds: MutableCluster.AsConditional(
        ColorControl2.ColorTemperatureComponent.attributes.startUpColorTemperatureMireds,
        { optionalIf: [CT] }
      )
    },
    commands: {
      moveToHue: MutableCluster.AsConditional(ColorControl2.HueSaturationComponent.commands.moveToHue, { mandatoryIf: [HS] }),
      moveHue: MutableCluster.AsConditional(ColorControl2.HueSaturationComponent.commands.moveHue, { mandatoryIf: [HS] }),
      stepHue: MutableCluster.AsConditional(ColorControl2.HueSaturationComponent.commands.stepHue, { mandatoryIf: [HS] }),
      moveToSaturation: MutableCluster.AsConditional(
        ColorControl2.HueSaturationComponent.commands.moveToSaturation,
        { mandatoryIf: [HS] }
      ),
      moveSaturation: MutableCluster.AsConditional(
        ColorControl2.HueSaturationComponent.commands.moveSaturation,
        { mandatoryIf: [HS] }
      ),
      stepSaturation: MutableCluster.AsConditional(
        ColorControl2.HueSaturationComponent.commands.stepSaturation,
        { mandatoryIf: [HS] }
      ),
      moveToHueAndSaturation: MutableCluster.AsConditional(
        ColorControl2.HueSaturationComponent.commands.moveToHueAndSaturation,
        { mandatoryIf: [HS] }
      ),
      moveToColor: MutableCluster.AsConditional(ColorControl2.XyComponent.commands.moveToColor, { mandatoryIf: [XY] }),
      moveColor: MutableCluster.AsConditional(ColorControl2.XyComponent.commands.moveColor, { mandatoryIf: [XY] }),
      stepColor: MutableCluster.AsConditional(ColorControl2.XyComponent.commands.stepColor, { mandatoryIf: [XY] }),
      moveToColorTemperature: MutableCluster.AsConditional(
        ColorControl2.ColorTemperatureComponent.commands.moveToColorTemperature,
        { mandatoryIf: [CT] }
      ),
      enhancedMoveToHue: MutableCluster.AsConditional(
        ColorControl2.EnhancedHueComponent.commands.enhancedMoveToHue,
        { mandatoryIf: [EHUE] }
      ),
      enhancedMoveHue: MutableCluster.AsConditional(
        ColorControl2.EnhancedHueComponent.commands.enhancedMoveHue,
        { mandatoryIf: [EHUE] }
      ),
      enhancedStepHue: MutableCluster.AsConditional(
        ColorControl2.EnhancedHueComponent.commands.enhancedStepHue,
        { mandatoryIf: [EHUE] }
      ),
      enhancedMoveToHueAndSaturation: MutableCluster.AsConditional(
        ColorControl2.EnhancedHueComponent.commands.enhancedMoveToHueAndSaturation,
        { mandatoryIf: [EHUE] }
      ),
      colorLoopSet: MutableCluster.AsConditional(ColorControl2.ColorLoopComponent.commands.colorLoopSet, { mandatoryIf: [CL] }),
      stopMoveStep: MutableCluster.AsConditional(
        ColorControl2.HueSaturationOrXyOrColorTemperatureComponent.commands.stopMoveStep,
        { mandatoryIf: [HS, XY, CT] }
      ),
      moveColorTemperature: MutableCluster.AsConditional(
        ColorControl2.ColorTemperatureComponent.commands.moveColorTemperature,
        { mandatoryIf: [CT] }
      ),
      stepColorTemperature: MutableCluster.AsConditional(
        ColorControl2.ColorTemperatureComponent.commands.stepColorTemperature,
        { mandatoryIf: [CT] }
      )
    }
  });
  ColorControl2.Complete = ColorControl2.CompleteInstance;
})(ColorControl || (ColorControl = {}));
const ColorControlCluster = ColorControl.Cluster;
ClusterRegistry.register(ColorControl.Complete);
export {
  ColorControl,
  ColorControlCluster
};
//# sourceMappingURL=color-control.js.map
