/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MutableCluster } from "../cluster/mutation/MutableCluster.js";
import {
  OptionalFixedAttribute,
  OptionalAttribute,
  Attribute,
  OptionalCommand,
  TlvNoResponse,
  Command,
  FixedAttribute,
  WritableAttribute
} from "../cluster/Cluster.js";
import { TlvUInt16, TlvPercent100ths, TlvPercent, TlvEnum, TlvUInt8, TlvBitmap } from "../tlv/TlvNumber.js";
import { TlvNullable } from "../tlv/TlvNullable.js";
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
import { BitFlag, BitFieldEnum } from "../schema/BitmapSchema.js";
import { AccessLevel } from "#model";
import { TlvNoArguments } from "../tlv/TlvNoArguments.js";
import { ClusterRegistry } from "../cluster/ClusterRegistry.js";
var WindowCovering;
((WindowCovering2) => {
  let Feature;
  ((Feature2) => {
    Feature2["Lift"] = "Lift";
    Feature2["Tilt"] = "Tilt";
    Feature2["PositionAwareLift"] = "PositionAwareLift";
    Feature2["AbsolutePosition"] = "AbsolutePosition";
    Feature2["PositionAwareTilt"] = "PositionAwareTilt";
  })(Feature = WindowCovering2.Feature || (WindowCovering2.Feature = {}));
  WindowCovering2.TlvGoToLiftPercentageRequest = TlvObject({ liftPercent100thsValue: TlvField(0, TlvPercent100ths) });
  WindowCovering2.TlvGoToTiltPercentageRequest = TlvObject({ tiltPercent100thsValue: TlvField(0, TlvPercent100ths) });
  WindowCovering2.TlvGoToLiftValueRequest = TlvObject({
    /**
     * This field shall specify the requested physical lift/slide position in unit cm (centimeters).
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.4.1
     */
    liftValue: TlvField(0, TlvUInt16)
  });
  WindowCovering2.TlvGoToTiltValueRequest = TlvObject({
    /**
     * This field shall specify the requested physical tilt position in unit 0.1° (tenth of a degrees).
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.6.1
     */
    tiltValue: TlvField(0, TlvUInt16)
  });
  let WindowCoveringType;
  ((WindowCoveringType2) => {
    WindowCoveringType2[WindowCoveringType2["Rollershade"] = 0] = "Rollershade";
    WindowCoveringType2[WindowCoveringType2["Rollershade2Motor"] = 1] = "Rollershade2Motor";
    WindowCoveringType2[WindowCoveringType2["RollershadeExterior"] = 2] = "RollershadeExterior";
    WindowCoveringType2[WindowCoveringType2["RollershadeExterior2Motor"] = 3] = "RollershadeExterior2Motor";
    WindowCoveringType2[WindowCoveringType2["Drapery"] = 4] = "Drapery";
    WindowCoveringType2[WindowCoveringType2["Awning"] = 5] = "Awning";
    WindowCoveringType2[WindowCoveringType2["Shutter"] = 6] = "Shutter";
    WindowCoveringType2[WindowCoveringType2["TiltBlindTiltOnly"] = 7] = "TiltBlindTiltOnly";
    WindowCoveringType2[WindowCoveringType2["TiltBlindLift"] = 8] = "TiltBlindLift";
    WindowCoveringType2[WindowCoveringType2["ProjectorScreen"] = 9] = "ProjectorScreen";
    WindowCoveringType2[WindowCoveringType2["Unknown"] = 255] = "Unknown";
  })(WindowCoveringType = WindowCovering2.WindowCoveringType || (WindowCovering2.WindowCoveringType = {}));
  WindowCovering2.ConfigStatus = {
    /**
     * Device is operational.
     *
     * This bit shall indicate whether the window covering is operational for regular use:
     *
     *   - 0 = Not Operational
     *
     *   - 1 = Operational
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.1.1
     */
    operational: BitFlag(0),
    onlineReserved: BitFlag(1),
    /**
     * The lift movement is reversed.
     *
     * This bit shall indicate whether the lift movement is reversed:
     *
     *   - 0 = Lift movement is normal
     *
     *   - 1 = Lift movement is reversed
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.1.2
     */
    liftMovementReversed: BitFlag(2),
    /**
     * Supports the PositionAwareLift feature (PA_LF).
     *
     * This bit shall indicate whether the window covering supports the PositionAwareLift feature:
     *
     *   - 0 = Lift control is not position aware
     *
     *   - 1 = Lift control is position aware (PA_LF)
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.1.3
     */
    liftPositionAware: BitFlag(3),
    /**
     * Supports the PositionAwareTilt feature (PA_TL).
     *
     * This bit shall indicate whether the window covering supports the PositionAwareTilt feature:
     *
     *   - 0 = Tilt control is not position aware
     *
     *   - 1 = Tilt control is position aware (PA_TL)
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.1.4
     */
    tiltPositionAware: BitFlag(4),
    /**
     * Uses an encoder for lift.
     *
     * This bit shall indicate whether a position aware controlled window covering is employing an encoder for
     * positioning the height of the window covering:
     *
     *   - 0 = Timer Controlled
     *
     *   - 1 = Encoder Controlled
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.1.5
     */
    liftEncoderControlled: BitFlag(5),
    /**
     * Uses an encoder for tilt.
     *
     * This bit shall indicate whether a position aware controlled window covering is employing an encoder for
     * tilting the window covering:
     *
     *   - 0 = Timer Controlled
     *
     *   - 1 = Encoder Controlled
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.1.6
     */
    tiltEncoderControlled: BitFlag(6)
  };
  WindowCovering2.OperationalStatus = {
    /**
     * Global operational state.
     *
     * These bits shall indicate in which direction the covering is currently moving or if it has stopped. Global
     * operational state shall always reflect the overall motion of the device.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.3.1
     */
    global: BitFieldEnum(0, 2),
    /**
     * Lift operational state.
     *
     * These bits shall indicate in which direction the covering’s lift is currently moving or if it has stopped.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.3.2
     */
    lift: BitFieldEnum(2, 2),
    /**
     * Tilt operational state.
     *
     * These bits shall indicate in which direction the covering’s tilt is currently moving or if it has stopped.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.3.3
     */
    tilt: BitFieldEnum(4, 2)
  };
  let MovementStatus;
  ((MovementStatus2) => {
    MovementStatus2[MovementStatus2["Stopped"] = 0] = "Stopped";
    MovementStatus2[MovementStatus2["Opening"] = 1] = "Opening";
    MovementStatus2[MovementStatus2["Closing"] = 2] = "Closing";
  })(MovementStatus = WindowCovering2.MovementStatus || (WindowCovering2.MovementStatus = {}));
  let EndProductType;
  ((EndProductType2) => {
    EndProductType2[EndProductType2["RollerShade"] = 0] = "RollerShade";
    EndProductType2[EndProductType2["RomanShade"] = 1] = "RomanShade";
    EndProductType2[EndProductType2["BalloonShade"] = 2] = "BalloonShade";
    EndProductType2[EndProductType2["WovenWood"] = 3] = "WovenWood";
    EndProductType2[EndProductType2["PleatedShade"] = 4] = "PleatedShade";
    EndProductType2[EndProductType2["CellularShade"] = 5] = "CellularShade";
    EndProductType2[EndProductType2["LayeredShade"] = 6] = "LayeredShade";
    EndProductType2[EndProductType2["LayeredShade2D"] = 7] = "LayeredShade2D";
    EndProductType2[EndProductType2["SheerShade"] = 8] = "SheerShade";
    EndProductType2[EndProductType2["TiltOnlyInteriorBlind"] = 9] = "TiltOnlyInteriorBlind";
    EndProductType2[EndProductType2["InteriorBlind"] = 10] = "InteriorBlind";
    EndProductType2[EndProductType2["VerticalBlindStripCurtain"] = 11] = "VerticalBlindStripCurtain";
    EndProductType2[EndProductType2["InteriorVenetianBlind"] = 12] = "InteriorVenetianBlind";
    EndProductType2[EndProductType2["ExteriorVenetianBlind"] = 13] = "ExteriorVenetianBlind";
    EndProductType2[EndProductType2["LateralLeftCurtain"] = 14] = "LateralLeftCurtain";
    EndProductType2[EndProductType2["LateralRightCurtain"] = 15] = "LateralRightCurtain";
    EndProductType2[EndProductType2["CentralCurtain"] = 16] = "CentralCurtain";
    EndProductType2[EndProductType2["RollerShutter"] = 17] = "RollerShutter";
    EndProductType2[EndProductType2["ExteriorVerticalScreen"] = 18] = "ExteriorVerticalScreen";
    EndProductType2[EndProductType2["AwningTerracePatio"] = 19] = "AwningTerracePatio";
    EndProductType2[EndProductType2["AwningVerticalScreen"] = 20] = "AwningVerticalScreen";
    EndProductType2[EndProductType2["TiltOnlyPergola"] = 21] = "TiltOnlyPergola";
    EndProductType2[EndProductType2["SwingingShutter"] = 22] = "SwingingShutter";
    EndProductType2[EndProductType2["SlidingShutter"] = 23] = "SlidingShutter";
    EndProductType2[EndProductType2["Unknown"] = 255] = "Unknown";
  })(EndProductType = WindowCovering2.EndProductType || (WindowCovering2.EndProductType = {}));
  WindowCovering2.Mode = {
    /**
     * Reverse the lift direction.
     *
     * This bit shall control the motor direction:
     *
     *   - 0 = Lift movement is normal
     *
     *   - 1 = Lift movement is reversed
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.2.1
     */
    motorDirectionReversed: BitFlag(0),
    /**
     * Perform a calibration.
     *
     * This bit shall set the window covering into calibration mode:
     *
     *   - 0 = Normal mode
     *
     *   - 1 = Calibration mode
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.2.2
     */
    calibrationMode: BitFlag(1),
    /**
     * Freeze all motions for maintenance.
     *
     * This bit shall set the window covering into maintenance mode:
     *
     *   - 0 = Normal mode
     *
     *   - 1 = Maintenance mode
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.2.3
     */
    maintenanceMode: BitFlag(2),
    /**
     * Control the LEDs feedback.
     *
     * This bit shall control feedback LEDs:
     *
     *   - 0 = LEDs are off
     *
     *   - 1 = LEDs will display feedback
     *
     * @see {@link MatterSpecification.v142.Cluster} § 5.3.5.2.4
     */
    ledFeedback: BitFlag(3)
  };
  WindowCovering2.SafetyStatus = {
    /**
     * Movement commands are ignored (locked out). e.g. not granted authorization, outside some time/date range.
     */
    remoteLockout: BitFlag(0),
    /**
     * Tampering detected on sensors or any other safety equipment. Ex: a device has been forcedly moved without its
     * actuator(s).
     */
    tamperDetection: BitFlag(1),
    /**
     * Communication failure to sensors or other safety equipment.
     */
    failedCommunication: BitFlag(2),
    /**
     * Device has failed to reach the desired position. e.g. with position aware device, time expired before
     * TargetPosition is reached.
     */
    positionFailure: BitFlag(3),
    /**
     * Motor(s) and/or electric circuit thermal protection activated.
     */
    thermalProtection: BitFlag(4),
    /**
     * An obstacle is preventing actuator movement.
     */
    obstacleDetected: BitFlag(5),
    /**
     * Device has power related issue or limitation e.g. device is running w/ the help of a backup battery or power
     * might not be fully available at the moment.
     */
    power: BitFlag(6),
    /**
     * Local safety sensor (not a direct obstacle) is preventing movements (e.g. Safety EU Standard EN60335).
     */
    stopInput: BitFlag(7),
    /**
     * Mechanical problem related to the motor(s) detected.
     */
    motorJammed: BitFlag(8),
    /**
     * PCB, fuse and other electrics problems.
     */
    hardwareFailure: BitFlag(9),
    /**
     * Actuator is manually operated and is preventing actuator movement (e.g. actuator is disengaged/decoupled).
     */
    manualOperation: BitFlag(10),
    /**
     * Protection is activated.
     */
    protection: BitFlag(11)
  };
  WindowCovering2.LiftAndPositionAwareLiftAndAbsolutePositionComponent = MutableCluster.Component({
    attributes: {
      /**
       * Indicates the maximum possible encoder position possible (Unit cm, centimeters) to position the height of
       * the window covering lift.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.2
       */
      physicalClosedLimitLift: OptionalFixedAttribute(1, TlvUInt16, { default: 0 }),
      /**
       * Indicates the actual lift position (Unit cm, centimeters) of the window covering from the fully-open
       * position.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.4
       */
      currentPositionLift: OptionalAttribute(3, TlvNullable(TlvUInt16), { persistent: true, default: null }),
      /**
       * Indicates the open limit for lifting the window covering whether position (in centimeters) is encoded or
       * timed.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.17
       */
      installedOpenLimitLift: Attribute(16, TlvUInt16.bound({ max: 65534 }), { persistent: true, default: 0 }),
      /**
       * Indicates the closed limit for lifting the window covering whether position (in centimeters) is encoded
       * or timed.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.18
       */
      installedClosedLimitLift: Attribute(
        17,
        TlvUInt16.bound({ max: 65534 }),
        { persistent: true, default: 65534 }
      )
    }
  });
  WindowCovering2.TiltAndPositionAwareTiltAndAbsolutePositionComponent = MutableCluster.Component({
    attributes: {
      /**
       * Indicates the maximum possible encoder position possible (Unit 0.1°, tenths of a degree) to position the
       * angle of the window covering tilt.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.3
       */
      physicalClosedLimitTilt: OptionalFixedAttribute(2, TlvUInt16, { default: 0 }),
      /**
       * Indicates the actual tilt position (Unit 0.1°, tenths of a degree) of the window covering from the
       * fully-open position.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.5
       */
      currentPositionTilt: OptionalAttribute(4, TlvNullable(TlvUInt16), { persistent: true, default: null }),
      /**
       * Indicates the open limit for tilting the window covering whether position (in tenth of a degree) is
       * encoded or timed.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.19
       */
      installedOpenLimitTilt: Attribute(18, TlvUInt16.bound({ max: 65534 }), { persistent: true, default: 0 }),
      /**
       * Indicates the closed limit for tilting the window covering whether position (in tenth of a degree) is
       * encoded or timed.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.20
       */
      installedClosedLimitTilt: Attribute(
        19,
        TlvUInt16.bound({ max: 65534 }),
        { persistent: true, default: 65534 }
      )
    }
  });
  WindowCovering2.LiftComponent = MutableCluster.Component({
    attributes: {
      /**
       * Indicates the total number of lift/slide actuations applied to the window covering since the device was
       * installed.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.6
       */
      numberOfActuationsLift: OptionalAttribute(5, TlvUInt16, { persistent: true, default: 0 })
    },
    commands: {
      /**
       * This command is used to set the target lift position of the window covering to the percentage value
       * specified in the command.
       *
       * Upon receipt of this command, the server will adjust the window covering to the lift/slide percentage
       * specified in the payload of this command.
       *
       * If the command includes LiftPercent100thsValue, then TargetPositionLiftPercent100ths attribute shall be
       * set to LiftPercent100thsValue. Otherwise the TargetPositionLiftPercent100ths attribute shall be set to
       * LiftPercentageValue * 100.
       *
       * If a client includes LiftPercent100thsValue in the command, the LiftPercentageValue shall be set to
       * LiftPercent100thsValue / 100, so a legacy server which only supports LiftPercentageValue (not
       * LiftPercent100thsValue) has a value to set the target position.
       *
       * If the server does not support the PositionAware feature, then a zero percentage shall be treated as a
       * UpOrOpen command and a non-zero percentage shall be treated as an DownOrClose command. If the device is
       * only a tilt control device, then the command SHOULD be ignored and a UNSUPPORTED_COMMAND status SHOULD be
       * returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.5
       */
      goToLiftPercentage: OptionalCommand(5, WindowCovering2.TlvGoToLiftPercentageRequest, 5, TlvNoResponse)
    }
  });
  WindowCovering2.TiltComponent = MutableCluster.Component({
    attributes: {
      /**
       * Indicates the total number of tilt actuations applied to the window covering since the device was
       * installed.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.7
       */
      numberOfActuationsTilt: OptionalAttribute(6, TlvUInt16, { persistent: true, default: 0 })
    },
    commands: {
      /**
       * This command is used to set the target tilt position of the window covering to the percentage value
       * specified in the command.
       *
       * Upon receipt of this command, the server will adjust the window covering to the tilt percentage specified
       * in the payload of this command.
       *
       * If the command includes TiltPercent100thsValue, then TargetPositionTiltPercent100ths attribute shall be
       * set to TiltPercent100thsValue. Otherwise the TargetPositionTiltPercent100ths attribute shall be set to
       * TiltPercentageValue * 100.
       *
       * If a client includes TiltPercent100thsValue in the command, the TiltPercentageValue shall be set to
       * TiltPercent100thsValue / 100, so a legacy server which only supports TiltPercentageValue (not
       * TiltPercent100thsValue) has a value to set the target position.
       *
       * If the server does not support the PositionAware feature, then a zero percentage shall be treated as a
       * UpOrOpen command and a non-zero percentage shall be treated as an DownOrClose command. If the device is
       * only a tilt control device, then the command SHOULD be ignored and a UNSUPPORTED_COMMAND status SHOULD be
       * returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.7
       */
      goToTiltPercentage: OptionalCommand(8, WindowCovering2.TlvGoToTiltPercentageRequest, 8, TlvNoResponse)
    }
  });
  WindowCovering2.LiftAndPositionAwareLiftComponent = MutableCluster.Component({
    attributes: {
      /**
       * Indicates the actual position as a percentage from 0% to 100% with 1% default step. This attribute is
       * equal to CurrentPositionLiftPercent100ths attribute divided by 100.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.11
       */
      currentPositionLiftPercentage: OptionalAttribute(
        8,
        TlvNullable(TlvPercent),
        { persistent: true, default: null }
      ),
      /**
       * Indicates the position where the window covering lift will go or is moving to as a percentage (Unit
       * 0.01%).
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.13
       */
      targetPositionLiftPercent100ths: Attribute(11, TlvNullable(TlvPercent100ths), { default: null }),
      /**
       * Indicates the actual position as a percentage with a minimal step of 0.01%. E.g Max 10000 equals 100.00%.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.9
       */
      currentPositionLiftPercent100ths: Attribute(
        14,
        TlvNullable(TlvPercent100ths),
        { persistent: true, default: null }
      )
    },
    commands: {
      /**
       * This command is used to set the target lift position of the window covering to the percentage value
       * specified in the command.
       *
       * Upon receipt of this command, the server will adjust the window covering to the lift/slide percentage
       * specified in the payload of this command.
       *
       * If the command includes LiftPercent100thsValue, then TargetPositionLiftPercent100ths attribute shall be
       * set to LiftPercent100thsValue. Otherwise the TargetPositionLiftPercent100ths attribute shall be set to
       * LiftPercentageValue * 100.
       *
       * If a client includes LiftPercent100thsValue in the command, the LiftPercentageValue shall be set to
       * LiftPercent100thsValue / 100, so a legacy server which only supports LiftPercentageValue (not
       * LiftPercent100thsValue) has a value to set the target position.
       *
       * If the server does not support the PositionAware feature, then a zero percentage shall be treated as a
       * UpOrOpen command and a non-zero percentage shall be treated as an DownOrClose command. If the device is
       * only a tilt control device, then the command SHOULD be ignored and a UNSUPPORTED_COMMAND status SHOULD be
       * returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.5
       */
      goToLiftPercentage: Command(5, WindowCovering2.TlvGoToLiftPercentageRequest, 5, TlvNoResponse)
    }
  });
  WindowCovering2.TiltAndPositionAwareTiltComponent = MutableCluster.Component({
    attributes: {
      /**
       * Indicates the actual position as a percentage from 0% to 100% with 1% default step. This attribute is
       * equal to CurrentPositionTiltPercent100ths attribute divided by 100.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.12
       */
      currentPositionTiltPercentage: OptionalAttribute(
        9,
        TlvNullable(TlvPercent),
        { persistent: true, default: null }
      ),
      /**
       * Indicates the position where the window covering tilt will go or is moving to as a percentage (Unit
       * 0.01%).
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.14
       */
      targetPositionTiltPercent100ths: Attribute(12, TlvNullable(TlvPercent100ths), { default: null }),
      /**
       * Indicates the actual position as a percentage with a minimal step of 0.01%. E.g Max 10000 equals 100.00%.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.10
       */
      currentPositionTiltPercent100ths: Attribute(
        15,
        TlvNullable(TlvPercent100ths),
        { persistent: true, default: null }
      )
    },
    commands: {
      /**
       * This command is used to set the target tilt position of the window covering to the percentage value
       * specified in the command.
       *
       * Upon receipt of this command, the server will adjust the window covering to the tilt percentage specified
       * in the payload of this command.
       *
       * If the command includes TiltPercent100thsValue, then TargetPositionTiltPercent100ths attribute shall be
       * set to TiltPercent100thsValue. Otherwise the TargetPositionTiltPercent100ths attribute shall be set to
       * TiltPercentageValue * 100.
       *
       * If a client includes TiltPercent100thsValue in the command, the TiltPercentageValue shall be set to
       * TiltPercent100thsValue / 100, so a legacy server which only supports TiltPercentageValue (not
       * TiltPercent100thsValue) has a value to set the target position.
       *
       * If the server does not support the PositionAware feature, then a zero percentage shall be treated as a
       * UpOrOpen command and a non-zero percentage shall be treated as an DownOrClose command. If the device is
       * only a tilt control device, then the command SHOULD be ignored and a UNSUPPORTED_COMMAND status SHOULD be
       * returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.7
       */
      goToTiltPercentage: Command(8, WindowCovering2.TlvGoToTiltPercentageRequest, 8, TlvNoResponse)
    }
  });
  WindowCovering2.LiftAndAbsolutePositionComponent = MutableCluster.Component({
    commands: {
      /**
       * This command is used to set the target lift position of the window covering to the value specified in the
       * command.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.4
       */
      goToLiftValue: OptionalCommand(4, WindowCovering2.TlvGoToLiftValueRequest, 4, TlvNoResponse)
    }
  });
  WindowCovering2.TiltAndAbsolutePositionComponent = MutableCluster.Component({
    commands: {
      /**
       * This command is used to set the target tilt position of the window covering to the value specified in the
       * command.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.6
       */
      goToTiltValue: OptionalCommand(7, WindowCovering2.TlvGoToTiltValueRequest, 7, TlvNoResponse)
    }
  });
  WindowCovering2.Base = MutableCluster.Component({
    id: 258,
    name: "WindowCovering",
    revision: 6,
    features: {
      /**
       * The Lift feature applies to window coverings that lift up and down (e.g. for a roller shade, Up and Down
       * is lift Open and Close) or slide left to right (e.g. for a sliding curtain, Left and Right is lift Open
       * and Close).
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.4.1
       */
      lift: BitFlag(0),
      /**
       * The Tilt feature applies to window coverings with vertical or horizontal strips.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.4.2
       */
      tilt: BitFlag(1),
      /**
       * Position aware lift control is supported.
       */
      positionAwareLift: BitFlag(2),
      /**
       * The percentage attributes shall indicate the position as a percentage between the InstalledOpenLimits and
       * InstalledClosedLimits attributes of the window covering starting at the open (0.00%).
       *
       * As a general rule, absolute positioning (in centimeters or tenth of a degrees) SHOULD NOT be supported
       * for new implementations.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.4.4
       */
      absolutePosition: BitFlag(3),
      /**
       * Position aware tilt control is supported.
       */
      positionAwareTilt: BitFlag(4)
    },
    attributes: {
      /**
       * This attribute shall identify the type of window covering.
       *
       * If the window covering supports the LF feature and not the TL feature, the following types shall be used
       * as the constraint for this attribute:
       *
       * If the window covering supports the TL feature and not the LF feature, the following types shall be used
       * as the constraint for this attribute:
       *
       * If the window covering supports both the LF and TL features, the following types are allowed to be used:
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.1
       */
      type: FixedAttribute(0, TlvEnum(), { default: 0 /* Rollershade */ }),
      /**
       * This attribute specifies the configuration and status information of the window covering.
       *
       * To change settings, devices shall write to the Mode attribute. The behavior causing the setting or
       * clearing of each bit is vendor specific.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.8
       */
      configStatus: Attribute(7, TlvBitmap(TlvUInt8, WindowCovering2.ConfigStatus), { persistent: true }),
      /**
       * Indicates the currently ongoing operations and applies to all type of devices.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.15
       */
      operationalStatus: Attribute(10, TlvBitmap(TlvUInt8, WindowCovering2.OperationalStatus)),
      /**
       * This attribute SHOULD provide more detail about the product type than can be determined from the main
       * category indicated by the Type attribute.
       *
       * If the window covering supports the LF feature and not the TL feature, the following types shall be used
       * as the constraint for this attribute:
       *
       * If the window covering supports the TL feature and not the LF feature, the following types shall be used
       * as the constraint for this attribute:
       *
       * If the window covering supports both the LF and TL features, the following types are allowed to be used:
       *
       * The table below helps to match the EndProductType attribute with the Type attribute.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.16
       */
      endProductType: FixedAttribute(13, TlvEnum(), { default: 0 /* RollerShade */ }),
      /**
       * The Mode attribute allows configuration of the window covering, such as: reversing the motor direction,
       * placing the window covering into calibration mode, placing the motor into maintenance mode, disabling the
       * network, and disabling status LEDs.
       *
       * In the case a device does not support or implement a specific mode, e.g. the device has a specific
       * installation method and reversal is not relevant or the device does not include a maintenance mode, any
       * write interaction to the Mode attribute, with an unsupported mode bit or any out of bounds bits set, must
       * be ignored and a response containing the status of CONSTRAINT_ERROR will be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.21
       */
      mode: WritableAttribute(
        23,
        TlvBitmap(TlvUInt8, WindowCovering2.Mode),
        { persistent: true, writeAcl: AccessLevel.Manage }
      ),
      /**
       * The SafetyStatus attribute reflects the state of the safety sensors and the common
       * issuespreventingmovements. By default for nominal operation all flags are cleared (0). A device might
       * support none, one or several bit flags from this attribute (all optional).
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.6.22
       */
      safetyStatus: OptionalAttribute(26, TlvBitmap(TlvUInt16, WindowCovering2.SafetyStatus))
    },
    commands: {
      /**
       * Upon receipt of this command, the window covering will adjust its position so the physical lift/slide and
       * tilt is at the maximum open/up position. This will happen as fast as possible. The server attributes
       * shall be updated as follows:
       *
       * if the PositionAware feature is supported:
       *
       *   - TargetPositionLiftPercent100ths attribute shall be set to 0.00%.
       *
       *   - TargetPositionTiltPercent100ths attribute shall be set to 0.00%.
       *
       * The server positioning attributes will follow the movements, once the movement has successfully finished,
       * the server attributes shall be updated as follows:
       *
       * if the PositionAware feature is supported:
       *
       *   - CurrentPositionLiftPercent100ths attribute shall be 0.00%.
       *
       *   - CurrentPositionLiftPercentage attribute shall be 0%.
       *
       *   - CurrentPositionTiltPercent100ths attribute shall be 0.00%.
       *
       *   - CurrentPositionTiltPercentage attribute shall be 0%.
       *
       * if the AbsolutePosition feature is supported:
       *
       *   - CurrentPositionLift attribute shall be equal to the InstalledOpenLimitLift attribute.
       *
       *   - CurrentPositionTilt attribute shall be equal to the InstalledOpenLimitTilt attribute.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.1
       */
      upOrOpen: Command(0, TlvNoArguments, 0, TlvNoResponse),
      /**
       * Upon receipt of this command, the window covering will adjust its position so the physical lift/slide and
       * tilt is at the maximum closed/down position. This will happen as fast as possible. The server attributes
       * supported shall be updated as follows:
       *
       * if the PositionAware feature is supported:
       *
       *   - TargetPositionLiftPercent100ths attribute shall be set to 100.00%.
       *
       *   - TargetPositionTiltPercent100ths attribute shall be set to 100.00%.
       *
       * The server positioning attributes will follow the movements, once the movement has successfully finished,
       * the server attributes shall be updated as follows:
       *
       * if the PositionAware feature is supported:
       *
       *   - CurrentPositionLiftPercent100ths attribute shall be 100.00%.
       *
       *   - CurrentPositionLiftPercentage attribute shall be 100%.
       *
       *   - CurrentPositionTiltPercent100ths attribute shall be 100.00%.
       *
       *   - CurrentPositionTiltPercentage attribute shall be 100%.
       *
       * if the AbsolutePosition feature is supported:
       *
       *   - CurrentPositionLift attribute shall be equal to the InstalledClosedLimitLift attribute.
       *
       *   - CurrentPositionTilt attribute shall be equal to the InstalledClosedLimitTilt attribute.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.2
       */
      downOrClose: Command(1, TlvNoArguments, 1, TlvNoResponse),
      /**
       * Upon receipt of this command, the window covering will stop any adjusting to the physical tilt and
       * lift/slide that is currently occurring. The server attributes supported shall be updated as follows:
       *
       *   - TargetPositionLiftPercent100ths attribute will be set to CurrentPositionLiftPercent100ths attribute
       *     value.
       *
       *   - TargetPositionTiltPercent100ths attribute will be set to CurrentPositionTiltPercent100ths attribute
       *     value.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 5.3.7.3
       */
      stopMotion: Command(2, TlvNoArguments, 2, TlvNoResponse)
    },
    /**
     * This metadata controls which WindowCoveringCluster elements matter.js activates for specific feature
     * combinations.
     */
    extensions: MutableCluster.Extensions(
      {
        flags: { lift: true, positionAwareLift: true, absolutePosition: true },
        component: WindowCovering2.LiftAndPositionAwareLiftAndAbsolutePositionComponent
      },
      {
        flags: { tilt: true, positionAwareTilt: true, absolutePosition: true },
        component: WindowCovering2.TiltAndPositionAwareTiltAndAbsolutePositionComponent
      },
      { flags: { lift: true }, component: WindowCovering2.LiftComponent },
      { flags: { tilt: true }, component: WindowCovering2.TiltComponent },
      { flags: { lift: true, positionAwareLift: true }, component: WindowCovering2.LiftAndPositionAwareLiftComponent },
      { flags: { tilt: true, positionAwareTilt: true }, component: WindowCovering2.TiltAndPositionAwareTiltComponent },
      { flags: { lift: true, absolutePosition: true }, component: WindowCovering2.LiftAndAbsolutePositionComponent },
      { flags: { tilt: true, absolutePosition: true }, component: WindowCovering2.TiltAndAbsolutePositionComponent },
      { flags: { positionAwareLift: true, lift: false }, component: false },
      { flags: { positionAwareTilt: true, tilt: false }, component: false },
      { flags: { lift: false, tilt: false }, component: false }
    )
  });
  WindowCovering2.ClusterInstance = MutableCluster.ExtensibleOnly(WindowCovering2.Base);
  WindowCovering2.Cluster = WindowCovering2.ClusterInstance;
  const LF_PA_LF_ABS = { lift: true, positionAwareLift: true, absolutePosition: true };
  const TL_PA_TL_ABS = { tilt: true, positionAwareTilt: true, absolutePosition: true };
  const LF = { lift: true };
  const TL = { tilt: true };
  const LF_PA_LF = { lift: true, positionAwareLift: true };
  const TL_PA_TL = { tilt: true, positionAwareTilt: true };
  const LF_ABS = { lift: true, absolutePosition: true };
  const TL_ABS = { tilt: true, absolutePosition: true };
  WindowCovering2.CompleteInstance = MutableCluster({
    id: WindowCovering2.Base.id,
    name: WindowCovering2.Base.name,
    revision: WindowCovering2.Base.revision,
    features: WindowCovering2.Base.features,
    attributes: {
      ...WindowCovering2.Base.attributes,
      physicalClosedLimitLift: MutableCluster.AsConditional(
        WindowCovering2.LiftAndPositionAwareLiftAndAbsolutePositionComponent.attributes.physicalClosedLimitLift,
        { optionalIf: [LF_PA_LF_ABS] }
      ),
      physicalClosedLimitTilt: MutableCluster.AsConditional(
        WindowCovering2.TiltAndPositionAwareTiltAndAbsolutePositionComponent.attributes.physicalClosedLimitTilt,
        { optionalIf: [TL_PA_TL_ABS] }
      ),
      currentPositionLift: MutableCluster.AsConditional(
        WindowCovering2.LiftAndPositionAwareLiftAndAbsolutePositionComponent.attributes.currentPositionLift,
        { optionalIf: [LF_PA_LF_ABS] }
      ),
      currentPositionTilt: MutableCluster.AsConditional(
        WindowCovering2.TiltAndPositionAwareTiltAndAbsolutePositionComponent.attributes.currentPositionTilt,
        { optionalIf: [TL_PA_TL_ABS] }
      ),
      numberOfActuationsLift: MutableCluster.AsConditional(
        WindowCovering2.LiftComponent.attributes.numberOfActuationsLift,
        { optionalIf: [LF] }
      ),
      numberOfActuationsTilt: MutableCluster.AsConditional(
        WindowCovering2.TiltComponent.attributes.numberOfActuationsTilt,
        { optionalIf: [TL] }
      ),
      currentPositionLiftPercentage: MutableCluster.AsConditional(
        WindowCovering2.LiftAndPositionAwareLiftComponent.attributes.currentPositionLiftPercentage,
        { optionalIf: [LF_PA_LF] }
      ),
      currentPositionTiltPercentage: MutableCluster.AsConditional(
        WindowCovering2.TiltAndPositionAwareTiltComponent.attributes.currentPositionTiltPercentage,
        { optionalIf: [TL_PA_TL] }
      ),
      targetPositionLiftPercent100ths: MutableCluster.AsConditional(
        WindowCovering2.LiftAndPositionAwareLiftComponent.attributes.targetPositionLiftPercent100ths,
        { mandatoryIf: [LF_PA_LF] }
      ),
      targetPositionTiltPercent100ths: MutableCluster.AsConditional(
        WindowCovering2.TiltAndPositionAwareTiltComponent.attributes.targetPositionTiltPercent100ths,
        { mandatoryIf: [TL_PA_TL] }
      ),
      currentPositionLiftPercent100ths: MutableCluster.AsConditional(
        WindowCovering2.LiftAndPositionAwareLiftComponent.attributes.currentPositionLiftPercent100ths,
        { mandatoryIf: [LF_PA_LF] }
      ),
      currentPositionTiltPercent100ths: MutableCluster.AsConditional(
        WindowCovering2.TiltAndPositionAwareTiltComponent.attributes.currentPositionTiltPercent100ths,
        { mandatoryIf: [TL_PA_TL] }
      ),
      installedOpenLimitLift: MutableCluster.AsConditional(
        WindowCovering2.LiftAndPositionAwareLiftAndAbsolutePositionComponent.attributes.installedOpenLimitLift,
        { mandatoryIf: [LF_PA_LF_ABS] }
      ),
      installedClosedLimitLift: MutableCluster.AsConditional(
        WindowCovering2.LiftAndPositionAwareLiftAndAbsolutePositionComponent.attributes.installedClosedLimitLift,
        { mandatoryIf: [LF_PA_LF_ABS] }
      ),
      installedOpenLimitTilt: MutableCluster.AsConditional(
        WindowCovering2.TiltAndPositionAwareTiltAndAbsolutePositionComponent.attributes.installedOpenLimitTilt,
        { mandatoryIf: [TL_PA_TL_ABS] }
      ),
      installedClosedLimitTilt: MutableCluster.AsConditional(
        WindowCovering2.TiltAndPositionAwareTiltAndAbsolutePositionComponent.attributes.installedClosedLimitTilt,
        { mandatoryIf: [TL_PA_TL_ABS] }
      )
    },
    commands: {
      ...WindowCovering2.Base.commands,
      goToLiftValue: MutableCluster.AsConditional(
        WindowCovering2.LiftAndAbsolutePositionComponent.commands.goToLiftValue,
        { optionalIf: [LF_ABS] }
      ),
      goToLiftPercentage: MutableCluster.AsConditional(
        WindowCovering2.LiftComponent.commands.goToLiftPercentage,
        { optionalIf: [LF], mandatoryIf: [LF_PA_LF] }
      ),
      goToTiltValue: MutableCluster.AsConditional(
        WindowCovering2.TiltAndAbsolutePositionComponent.commands.goToTiltValue,
        { optionalIf: [TL_ABS] }
      ),
      goToTiltPercentage: MutableCluster.AsConditional(
        WindowCovering2.TiltComponent.commands.goToTiltPercentage,
        { optionalIf: [TL], mandatoryIf: [TL_PA_TL] }
      )
    }
  });
  WindowCovering2.Complete = WindowCovering2.CompleteInstance;
})(WindowCovering || (WindowCovering = {}));
const WindowCoveringCluster = WindowCovering.Cluster;
ClusterRegistry.register(WindowCovering.Complete);
export {
  WindowCovering,
  WindowCoveringCluster
};
//# sourceMappingURL=window-covering.js.map
