"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var FanControl_exports = {};
__export(FanControl_exports, {
  FanControl: () => FanControl
});
module.exports = __toCommonJS(FanControl_exports);
var import_MatterDefinition = require("../MatterDefinition.js");
var import_elements = require("../../elements/index.js");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
const FanControl = (0, import_elements.ClusterElement)(
  {
    name: "FanControl",
    id: 514,
    classification: "application",
    pics: "FAN",
    details: "This cluster specifies an interface to control the speed of a fan.",
    xref: { document: "cluster", section: "4.4" }
  },
  (0, import_elements.AttributeElement)({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 4 }),
  (0, import_elements.AttributeElement)(
    { name: "FeatureMap", id: 65532, type: "FeatureMap", xref: { document: "cluster", section: "4.4.4" } },
    (0, import_elements.FieldElement)({
      name: "SPD",
      constraint: "0",
      description: "MultiSpeed",
      details: "Legacy Fan Control cluster revision 0-1 defined 3 speeds (low, medium and high) plus automatic speed control but left it up to the implementer to decide what was supported. Therefore, it is assumed that legacy client implementations are capable of determining, from the server, the number of speeds supported between 1, 2, or 3, and whether automatic speed control is supported.\nThe MultiSpeed feature includes new attributes that support a running fan speed value from 0 to SpeedMax, which has a maximum of 100.\nSee Speed Rules for more details.",
      xref: { document: "cluster", section: "4.4.4.1" }
    }),
    (0, import_elements.FieldElement)({ name: "AUT", constraint: "1", description: "Auto", details: "Automatic mode supported for fan speed" }),
    (0, import_elements.FieldElement)({ name: "RCK", constraint: "2", description: "Rocking", details: "Rocking movement supported" }),
    (0, import_elements.FieldElement)({ name: "WND", constraint: "3", description: "Wind", details: "Wind emulation supported" }),
    (0, import_elements.FieldElement)({ name: "STEP", constraint: "4", description: "Step", details: "Step command supported" }),
    (0, import_elements.FieldElement)({
      name: "DIR",
      constraint: "5",
      description: "AirflowDirection",
      details: "Airflow Direction attribute is supported"
    })
  ),
  (0, import_elements.AttributeElement)({
    name: "FanMode",
    id: 0,
    type: "FanModeEnum",
    access: "RW VO",
    conformance: "M",
    constraint: "0 to 6",
    default: 0,
    quality: "N",
    details: "Indicates the current speed mode of the fan. This attribute may be written by the client to request a different fan mode. A server shall return INVALID_IN_STATE to indicate that the fan is not in a state where the FanMode can be changed to the requested value. A server may have FanMode values that it can never be set to. For example, where this cluster appears on the same or another endpoint as other clusters with a system dependency, for example the Thermostat cluster, attempting to set the FanMode attribute of this cluster to Off may not be allowed by the system.\nThis attribute shall be set to one of the values in FanModeEnum.\nWhen the FanMode attribute is successfully written to, the PercentSetting and SpeedSetting (if present) attributes shall be set to appropriate values, as defined by the Percent Rules and Speed Rules respectively, unless otherwise specified below.\nWhen the FanMode attribute is set to any given mode, the PercentCurrent and SpeedCurrent (if present) shall indicate the actual currently operating fan speed, unless otherwise specified below.",
    xref: { document: "cluster", section: "4.4.6.1" }
  }),
  (0, import_elements.AttributeElement)({
    name: "FanModeSequence",
    id: 1,
    type: "FanModeSequenceEnum",
    access: "R V",
    conformance: "M",
    constraint: "0 to 5",
    quality: "F",
    details: "This attribute indicates the fan speed ranges that shall be supported.",
    xref: { document: "cluster", section: "4.4.6.2" }
  }),
  (0, import_elements.AttributeElement)({
    name: "PercentSetting",
    id: 2,
    type: "percent",
    access: "RW VO",
    conformance: "M",
    constraint: "0 to 100",
    default: 0,
    quality: "X",
    details: "Indicates the speed setting for the fan. This attribute may be written by the client to indicate a new fan speed. If the client writes null to this attribute, the attribute value shall NOT change. A server shall return INVALID_IN_STATE to indicate that the fan is not in a state where the PercentSetting can be changed to the requested value.\nIf this is successfully written to 0, the server shall set the FanMode attribute value to Off.",
    xref: { document: "cluster", section: "4.4.6.3" }
  }),
  (0, import_elements.AttributeElement)({
    name: "PercentCurrent",
    id: 3,
    type: "percent",
    access: "R V",
    conformance: "M",
    constraint: "0 to 100",
    details: "Indicates the actual currently operating fan speed, or zero to indicate that the fan is off. There may be a temporary mismatch between the value of this attribute and the value of the PercentSetting attribute due to other system requirements that would not allow the fan to operate at the requested setting. See Percent Rules for more details.",
    xref: { document: "cluster", section: "4.4.6.4" }
  }),
  (0, import_elements.AttributeElement)({
    name: "SpeedMax",
    id: 4,
    type: "uint8",
    access: "R V",
    conformance: "SPD",
    constraint: "1 to 100",
    quality: "F",
    details: "Indicates that the fan has one speed (value of 1) or the maximum speed, if the fan is capable of multiple speeds.",
    xref: { document: "cluster", section: "4.4.6.5" }
  }),
  (0, import_elements.AttributeElement)({
    name: "SpeedSetting",
    id: 5,
    type: "uint8",
    access: "RW VO",
    conformance: "SPD",
    constraint: "0 to speedMax",
    default: 0,
    quality: "X",
    details: "Indicates the speed setting for the fan. This attribute may be written by the client to indicate a new fan speed. If the client writes null to this attribute, the attribute value shall NOT change. A server shall return INVALID_IN_STATE to indicate that the fan is not in a state where the SpeedSetting can be changed to the requested value.\nIf this is successfully written to 0, the server shall set the FanMode attribute value to Off. Please see the Speed Rules for details on other values.",
    xref: { document: "cluster", section: "4.4.6.6" }
  }),
  (0, import_elements.AttributeElement)({
    name: "SpeedCurrent",
    id: 6,
    type: "uint8",
    access: "R V",
    conformance: "SPD",
    constraint: "0 to speedMax",
    quality: "P",
    details: "Indicates the actual currently operating fan speed, or zero to indicate that the fan is off. There may be a temporary mismatch between the value of this attribute and the value of the SpeedSetting attribute due to other system requirements that would not allow the fan to operate at the requested setting.",
    xref: { document: "cluster", section: "4.4.6.7" }
  }),
  (0, import_elements.AttributeElement)({
    name: "RockSupport",
    id: 7,
    type: "RockBitmap",
    access: "R V",
    conformance: "RCK",
    constraint: "desc",
    default: 0,
    quality: "F",
    details: "This attribute is a bitmap that indicates what rocking motions the server supports.",
    xref: { document: "cluster", section: "4.4.6.8" }
  }),
  (0, import_elements.AttributeElement)({
    name: "RockSetting",
    id: 8,
    type: "RockBitmap",
    access: "RW VO",
    conformance: "RCK",
    constraint: "desc",
    default: 0,
    quality: "P",
    details: "This attribute is a bitmap that indicates the current active fan rocking motion settings. Each bit shall only be set to 1, if the corresponding bit in the RockSupport attribute is set to 1, otherwise a status code of CONSTRAINT_ERROR shall be returned.\nIf a combination of supported bits is set by the client, and the server does not support the combination, the lowest supported single bit in the combination shall be set and active, and all other bits shall indicate zero.\nFor example: If RockUpDown and RockRound are both set, but this combination is not possible, then only RockUpDown becomes active.",
    xref: { document: "cluster", section: "4.4.6.9" }
  }),
  (0, import_elements.AttributeElement)({
    name: "WindSupport",
    id: 9,
    type: "WindBitmap",
    access: "R V",
    conformance: "WND",
    constraint: "desc",
    default: 0,
    quality: "F",
    details: "This attribute is a bitmap that indicates what wind modes the server supports. At least one wind mode bit shall be set.",
    xref: { document: "cluster", section: "4.4.6.10" }
  }),
  (0, import_elements.AttributeElement)({
    name: "WindSetting",
    id: 10,
    type: "WindBitmap",
    access: "RW VO",
    conformance: "WND",
    constraint: "desc",
    default: 0,
    quality: "P",
    details: "This attribute is a bitmap that indicates the current active fan wind feature settings. Each bit shall only be set to 1, if the corresponding bit in the WindSupport attribute is set to 1, otherwise a status code of CONSTRAINT_ERROR shall be returned.\nIf a combination of supported bits is set by the client, and the server does not support the combination, the lowest supported single bit in the combination shall be set and active, and all other bits shall indicate zero.\nFor example: If Sleep Wind and Natural Wind are set, but this combination is not possible, then only Sleep Wind becomes active.",
    xref: { document: "cluster", section: "4.4.6.11" }
  }),
  (0, import_elements.AttributeElement)({
    name: "AirflowDirection",
    id: 11,
    type: "AirflowDirectionEnum",
    access: "RW VO",
    conformance: "DIR",
    constraint: "desc",
    default: 0,
    quality: "P",
    details: "Indicates the current airflow direction of the fan. This attribute may be written by the client to indicate a new airflow direction for the fan. This attribute shall be set to one of the values in the AirflowDirectionEnum table.",
    xref: { document: "cluster", section: "4.4.6.12" }
  }),
  (0, import_elements.CommandElement)(
    {
      name: "Step",
      id: 0,
      access: "O",
      conformance: "STEP",
      direction: "request",
      response: "status",
      details: "This command speeds up or slows down the fan, in steps, without the client having to know the fan speed. This command supports, for example, a user operated wall switch, where the user provides the feedback or control to stop sending this command when the proper speed is reached. The step speed values are implementation specific. How many step speeds are implemented is implementation specific.\nThis command supports these fields:",
      xref: { document: "cluster", section: "4.4.7.1" }
    },
    (0, import_elements.FieldElement)({
      name: "Direction",
      id: 0,
      type: "StepDirectionEnum",
      conformance: "M",
      default: 0,
      details: "This field shall indicate whether the fan speed increases or decreases to the next step value.",
      xref: { document: "cluster", section: "4.4.7.1.1" }
    }),
    (0, import_elements.FieldElement)({
      name: "Wrap",
      id: 1,
      type: "bool",
      conformance: "O",
      default: false,
      details: "This field shall indicate if the fan speed wraps between highest and lowest step value.",
      xref: { document: "cluster", section: "4.4.7.1.2" }
    }),
    (0, import_elements.FieldElement)({
      name: "LowestOff",
      id: 2,
      type: "bool",
      conformance: "O",
      default: true,
      details: "This field shall indicate that the fan being off (speed value 0) is included as a step value.",
      xref: { document: "cluster", section: "4.4.7.1.3" }
    })
  ),
  (0, import_elements.DatatypeElement)(
    { name: "RockBitmap", type: "map8", xref: { document: "cluster", section: "4.4.5.1" } },
    (0, import_elements.FieldElement)({ name: "RockLeftRight", constraint: "0", description: "Indicate rock left to right" }),
    (0, import_elements.FieldElement)({ name: "RockUpDown", constraint: "1", description: "Indicate rock up and down" }),
    (0, import_elements.FieldElement)({ name: "RockRound", constraint: "2", description: "Indicate rock around" })
  ),
  (0, import_elements.DatatypeElement)(
    { name: "WindBitmap", type: "map8", xref: { document: "cluster", section: "4.4.5.2" } },
    (0, import_elements.FieldElement)({ name: "SleepWind", constraint: "0", description: "Indicate sleep wind" }),
    (0, import_elements.FieldElement)({ name: "NaturalWind", constraint: "1", description: "Indicate natural wind" })
  ),
  (0, import_elements.DatatypeElement)(
    { name: "StepDirectionEnum", type: "enum8", xref: { document: "cluster", section: "4.4.5.3" } },
    (0, import_elements.FieldElement)({ name: "Increase", id: 0, conformance: "M", description: "Step moves in increasing direction" }),
    (0, import_elements.FieldElement)({ name: "Decrease", id: 1, conformance: "M", description: "Step moves in decreasing direction" })
  ),
  (0, import_elements.DatatypeElement)(
    { name: "AirflowDirectionEnum", type: "enum8", xref: { document: "cluster", section: "4.4.5.4" } },
    (0, import_elements.FieldElement)({ name: "Forward", id: 0, conformance: "M", description: "Airflow is in the forward direction" }),
    (0, import_elements.FieldElement)({ name: "Reverse", id: 1, conformance: "M", description: "Airflow is in the reverse direction" })
  ),
  (0, import_elements.DatatypeElement)(
    { name: "FanModeEnum", type: "enum8", xref: { document: "cluster", section: "4.4.5.5" } },
    (0, import_elements.FieldElement)({ name: "Off", id: 0, conformance: "M", description: "Fan is off" }),
    (0, import_elements.FieldElement)({
      name: "Low",
      id: 1,
      conformance: "desc",
      description: "Fan using low speed",
      details: "If the fan supports 2 or more speeds, the Low value shall be supported.\nThe Low value shall be supported if and only if the FanModeSequence attribute value is less than 4.",
      xref: { document: "cluster", section: "4.4.5.5.1" }
    }),
    (0, import_elements.FieldElement)({
      name: "Medium",
      id: 2,
      conformance: "desc",
      description: "Fan using medium speed",
      details: "If the fan supports 3 or more speeds, the Medium value shall be supported.\nThe Medium value shall be supported if and only if the FanModeSequence attribute value is 0 or 2.",
      xref: { document: "cluster", section: "4.4.5.5.2" }
    }),
    (0, import_elements.FieldElement)({ name: "High", id: 3, conformance: "M", description: "Fan using high speed" }),
    (0, import_elements.FieldElement)({ name: "On", id: 4, conformance: "D" }),
    (0, import_elements.FieldElement)({ name: "Auto", id: 5, conformance: "AUT", description: "Fan is using auto mode" }),
    (0, import_elements.FieldElement)({ name: "Smart", id: 6, conformance: "D", description: "Fan is using smart mode" })
  ),
  (0, import_elements.DatatypeElement)(
    { name: "FanModeSequenceEnum", type: "enum8", xref: { document: "cluster", section: "4.4.5.6" } },
    (0, import_elements.FieldElement)({
      name: "OffLowMedHigh",
      id: 0,
      conformance: "[!AUT].a",
      description: "Fan is capable of off, low, medium and high modes"
    }),
    (0, import_elements.FieldElement)({
      name: "OffLowHigh",
      id: 1,
      conformance: "[!AUT].a",
      description: "Fan is capable of off, low and high modes"
    }),
    (0, import_elements.FieldElement)({
      name: "OffLowMedHighAuto",
      id: 2,
      conformance: "[AUT].a",
      description: "Fan is capable of off, low, medium, high and auto modes"
    }),
    (0, import_elements.FieldElement)({
      name: "OffLowHighAuto",
      id: 3,
      conformance: "[AUT].a",
      description: "Fan is capable of off, low, high and auto modes"
    }),
    (0, import_elements.FieldElement)({
      name: "OffHighAuto",
      id: 4,
      conformance: "[AUT].a",
      description: "Fan is capable of off, high and auto modes"
    }),
    (0, import_elements.FieldElement)({ name: "OffHigh", id: 5, conformance: "[!AUT].a", description: "Fan is capable of off and high modes" })
  )
);
import_MatterDefinition.MatterDefinition.children.push(FanControl);
//# sourceMappingURL=FanControl.js.map
