"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 ModeBase_exports = {};
__export(ModeBase_exports, {
  ModeBase: () => ModeBase
});
module.exports = __toCommonJS(ModeBase_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 ModeBase = (0, import_elements.ClusterElement)(
  {
    name: "ModeBase",
    classification: "application",
    pics: "MODB",
    details: "This cluster provides an interface for controlling a characteristic of a device that can be set to one of several predefined values. For example, the light pattern of a disco ball, the mode of a massage chair, or the wash cycle of a laundry machine.\nThe server allows the client to set a mode on the server. A mode is one of a list of options that may be presented by a client for a user choice, or understood by the client, via the mode\u2019s tags.\nA mode tag is either a standard tag within a standard category namespace, or a manufacturer specific tag, within the namespace of the vendor ID of the manufacturer.\nAny derived cluster specification based on this cluster shall support the standard mode tag value definitions and command status definitions defined in this cluster and may define additional standard mode tag values and standard command status values that are supported in the respective derived cluster instances.\nEach cluster ID that indicates this specification shall define a distinct purpose for the cluster instance. For example: A LightBlinking cluster ID supports blinking modes for a light (and is described that way).\nAn anonymous mode shall NOT replace the meaning of a standard mode tag, when one exists, for the cluster purpose.",
    xref: { document: "cluster", section: "1.10" }
  },
  (0, import_elements.AttributeElement)({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 2 }),
  (0, import_elements.AttributeElement)(
    { name: "FeatureMap", id: 65532, type: "FeatureMap", xref: { document: "cluster", section: "1.10.4" } },
    (0, import_elements.FieldElement)({
      name: "DEPONOFF",
      constraint: "0",
      description: "OnOff",
      details: "This feature creates a dependency between an OnOff cluster instance and this cluster instance on the same endpoint. See OnMode for more information.",
      xref: { document: "cluster", section: "1.10.4.1" }
    })
  ),
  (0, import_elements.AttributeElement)(
    {
      name: "SupportedModes",
      id: 0,
      type: "list",
      access: "R V",
      conformance: "M",
      constraint: "2 to 255",
      quality: "F",
      details: "This attribute shall contain the list of supported modes that may be selected for the CurrentMode attribute. Each item in this list represents a unique mode as indicated by the Mode field of the ModeOptionStruct.\nEach entry in this list shall have a unique value for the Mode field. Each entry in this list shall have a unique value for the Label field.",
      xref: { document: "cluster", section: "1.10.6.2" }
    },
    (0, import_elements.FieldElement)({ name: "entry", type: "ModeOptionStruct" })
  ),
  (0, import_elements.AttributeElement)({
    name: "CurrentMode",
    id: 1,
    type: "uint8",
    access: "R V",
    conformance: "M",
    constraint: "desc",
    quality: "N S",
    details: "Indicates the current mode of the server.\nThe value of this field shall match the Mode field of one of the entries in the SupportedModes attribute.\nThe value of this attribute may change at any time via an out-of-band interaction outside of the server, such as interactions with a user interface, via internal mode changes due to autonomously progressing through a sequence of operations, on system time-outs or idle delays, or via interactions coming from a fabric other than the one which last executed a ChangeToMode.",
    xref: { document: "cluster", section: "1.10.6.3" }
  }),
  (0, import_elements.AttributeElement)({
    name: "StartUpMode",
    id: 2,
    type: "uint8",
    access: "RW VO",
    conformance: "O",
    constraint: "desc",
    quality: "X N",
    details: "Indicates the desired startup mode for the server when it is supplied with power.\nIf this attribute is not null, the CurrentMode attribute shall be set to the StartUpMode value, when the server is powered up, except in the case when the OnMode attribute overrides the StartUpMode attribute (see OnModeWithPowerUp).\nThis behavior does not apply to reboots associated with OTA. After an OTA restart, the CurrentMode attribute shall return to its value prior to the restart.\nThe value of this field shall match the Mode field of one of the entries in the SupportedModes attribute.\nIf this attribute is not implemented, or is set to the null value, it shall have no effect.",
    xref: { document: "cluster", section: "1.10.6.4" }
  }),
  (0, import_elements.AttributeElement)({
    name: "OnMode",
    id: 3,
    type: "uint8",
    access: "RW VO",
    conformance: "DEPONOFF",
    constraint: "desc",
    default: null,
    quality: "X N",
    details: "Indicates whether the value of CurrentMode depends on the state of the On/Off cluster on the same endpoint. If this attribute is not present or is set to null, there is no dependency, otherwise the CurrentMode attribute shall depend on the OnOff attribute in the On/Off cluster\nThe value of this field shall match the Mode field of one of the entries in the SupportedModes attribute.",
    xref: { document: "cluster", section: "1.10.6.5" }
  }),
  (0, import_elements.CommandElement)(
    {
      name: "ChangeToMode",
      id: 0,
      access: "O",
      conformance: "M",
      direction: "request",
      response: "ChangeToModeResponse",
      details: "This command is used to change device modes.\nOn receipt of this command the device shall respond with a ChangeToModeResponse command.",
      xref: { document: "cluster", section: "1.10.7.1" }
    },
    (0, import_elements.FieldElement)({
      name: "NewMode",
      id: 0,
      type: "uint8",
      conformance: "M",
      constraint: "desc",
      details: "If the NewMode field doesn\u2019t match the Mode field of any entry of the SupportedModes list, the ChangeToModeResponse command\u2019s Status field shall indicate UnsupportedMode and the StatusText field shall be included and may be used to indicate the issue, with a human readable string, or include an empty string.\nIf the NewMode field matches the Mode field of one entry of the SupportedModes list, but the device is not able to transition as requested, the ChangeToModeResponse command shall:\n  \u2022 Have the Status set to a product-specific Status value representing the error, or     GenericFailure if a more specific error cannot be provided. See Status Field for details.\n  \u2022 Provide a human readable string in the StatusText field.\nIf the NewMode field matches the Mode field of one entry of the SupportedModes list and the device is able to transition as requested, the server shall transition into the mode associated with NewMode, the ChangeToModeResponse command shall have the Status field set to Success, the StatusText field may be supplied with a human readable string or include an empty string and the CurrentMode field shall be set to the value of the NewMode field.\nIf the NewMode field is the same as the value of the CurrentMode attribute the ChangeToModeRe\nsponse command shall have the Status field set to Success and the StatusText field may be supplied with a human readable string or include an empty string.",
      xref: { document: "cluster", section: "1.10.7.1.1" }
    })
  ),
  (0, import_elements.CommandElement)(
    {
      name: "ChangeToModeResponse",
      id: 1,
      access: "O",
      conformance: "M",
      direction: "response",
      details: "This command is sent by the device on receipt of the ChangeToMode command.",
      xref: { document: "cluster", section: "1.10.7.2" }
    },
    (0, import_elements.FieldElement)({
      name: "Status",
      id: 0,
      type: "status",
      conformance: "M",
      constraint: "desc",
      xref: { document: "cluster", section: "1.10.7.2.1" }
    }),
    (0, import_elements.FieldElement)({ name: "StatusText", id: 1, type: "string", conformance: "[Status == Success], M", constraint: "max 64" })
  ),
  (0, import_elements.DatatypeElement)(
    {
      name: "ModeTagStruct",
      type: "struct",
      details: "A Mode Tag is meant to be interpreted by the client for the purpose the cluster serves.",
      xref: { document: "cluster", section: "1.10.5.1" }
    },
    (0, import_elements.FieldElement)({
      name: "MfgCode",
      id: 0,
      type: "vendor-id",
      conformance: "O",
      constraint: "desc",
      details: 'If the MfgCode field exists, the Value field shall be in the manufacturer-specific value range (see Section 1.10.8, \u201CMode Namespace\u201D).\nThis field shall indicate the manufacturer\u2019s VendorID and it shall determine the meaning of the Value field.\nThe same manufacturer code and mode tag value in separate cluster instances are part of the same namespace and have the same meaning. For example: a manufacturer tag meaning "pinch" can be used both in a cluster whose purpose is to choose the amount of sugar, or in a cluster whose purpose is to choose the amount of salt.',
      xref: { document: "cluster", section: "1.10.5.1.1" }
    }),
    (0, import_elements.FieldElement)({
      name: "Value",
      id: 1,
      type: "ModeTag",
      conformance: "M",
      details: "This field shall indicate the mode tag within a mode tag namespace which is either manufacturer specific or standard.",
      xref: { document: "cluster", section: "1.10.5.1.2" }
    })
  ),
  (0, import_elements.DatatypeElement)(
    {
      name: "ModeOptionStruct",
      type: "struct",
      details: "This is a struct representing a possible mode of the server.",
      xref: { document: "cluster", section: "1.10.5.2" }
    },
    (0, import_elements.FieldElement)({
      name: "Label",
      id: 0,
      type: "string",
      conformance: "M",
      constraint: "max 64",
      quality: "F",
      details: "This field shall indicate readable text that describes the mode option, so that a client can provide it to the user to indicate what this option means. This field is meant to be readable and understandable by the user.",
      xref: { document: "cluster", section: "1.10.5.2.1" }
    }),
    (0, import_elements.FieldElement)({
      name: "Mode",
      id: 1,
      type: "uint8",
      conformance: "M",
      quality: "F",
      details: "This field is used to identify the mode option.",
      xref: { document: "cluster", section: "1.10.5.2.2" }
    }),
    (0, import_elements.FieldElement)(
      {
        name: "ModeTags",
        id: 2,
        type: "list",
        conformance: "M",
        constraint: "max 8",
        quality: "F",
        details: 'This field shall contain a list of tags that are associated with the mode option. This may be used by clients to determine the full or the partial semantics of a certain mode, depending on which tags they understand, using standard definitions and/or manufacturer specific namespace definitions.\nThe standard mode tags are defined in this cluster specification. For the derived cluster instances, if the specification of the derived cluster defines a namespace, the set of standard mode tags also includes the mode tag values from that namespace.\nMode tags can help clients look for options that meet certain criteria, render the user interface, use\nthe mode in an automation, or to craft help text their voice-driven interfaces. A mode tag shall be either a standard tag or a manufacturer specific tag, as defined in each ModeTagStruct list entry.\nA mode option may have more than one mode tag. A mode option may be associated with a mixture of standard and manufacturer specific mode tags. A mode option shall be associated with at least one standard mode tag.\nA few examples are provided below.\n  \u2022 A mode named "100%" can have both the High (manufacturer specific) and Max (standard) mode tag.     Clients seeking the mode for either High or Max will find the same mode in this case.\n  \u2022 A mode that includes a LowEnergy tag can be displayed by the client using a widget icon that     shows a green leaf.\n  \u2022 A mode that includes a LowNoise tag may be used by the client when the user wishes for a lower     level of audible sound, less likely to disturb the household\u2019s activities.\n  \u2022 A mode that includes a LowEnergy tag (standard, defined in this cluster specification) and also     a Delicate tag (standard, defined in the namespace of a Laundry Mode derived cluster).\n  \u2022 A mode that includes both a generic Quick tag (defined here), and Vacuum and Mop tags, (defined     in the RVC Clean cluster that is a derivation of this cluster).',
        xref: { document: "cluster", section: "1.10.5.2.3" }
      },
      (0, import_elements.FieldElement)({ name: "entry", type: "ModeTagStruct" })
    )
  ),
  (0, import_elements.DatatypeElement)(
    { name: "ModeChangeStatus", type: "enum8" },
    (0, import_elements.FieldElement)({
      name: "Success",
      id: 0,
      description: "Switching to the mode indicated by the NewMode field is allowed and possible. The CurrentMode attribute is set to the value of the NewMode field.",
      xref: { document: "cluster", section: "1.10.7.2.1.2" }
    }),
    (0, import_elements.FieldElement)({
      name: "UnsupportedMode",
      id: 1,
      description: "The value of the NewMode field doesn\u2019t match any entries in the SupportedMode attribute.",
      xref: { document: "cluster", section: "1.10.7.2.1.2" }
    }),
    (0, import_elements.FieldElement)({
      name: "GenericFailure",
      id: 2,
      description: "Generic failure code, indicating that switching to the mode indicated by the NewMode field is not allowed or not possible.",
      xref: { document: "cluster", section: "1.10.7.2.1.2" }
    }),
    (0, import_elements.FieldElement)({
      name: "InvalidInMode",
      id: 3,
      description: "The received request cannot be handled due to the current mode of the device",
      xref: { document: "cluster", section: "1.10.7.2.1.2" }
    })
  ),
  (0, import_elements.DatatypeElement)(
    { name: "ModeTag", type: "enum16" },
    (0, import_elements.FieldElement)({
      name: "Auto",
      id: 0,
      description: "The device decides which options, features and setting values to use.",
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "Quick",
      id: 1,
      description: "The mode of the device is optimizing for faster completion.",
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "Quiet",
      id: 2,
      description: "The device is silent or barely audible while in this mode.",
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "LowNoise",
      id: 3,
      description: "Either the mode is inherently low noise or the device optimizes for that.",
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "LowEnergy",
      id: 4,
      description: 'The device is optimizing for lower energy usage in this mode. Sometimes called "Eco mode".',
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "Vacation",
      id: 5,
      description: "A mode suitable for use during vacations or other extended absences.",
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "Min",
      id: 6,
      description: "The mode uses the lowest available setting value.",
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "Max",
      id: 7,
      description: "The mode uses the highest available setting value.",
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "Night",
      id: 8,
      description: "The mode is recommended or suitable for use during night time.",
      xref: { document: "cluster", section: "1.10.8" }
    }),
    (0, import_elements.FieldElement)({
      name: "Day",
      id: 9,
      description: "The mode is recommended or suitable for use during day time.",
      xref: { document: "cluster", section: "1.10.8" }
    })
  )
);
import_MatterDefinition.MatterDefinition.children.push(ModeBase);
//# sourceMappingURL=ModeBase.js.map
