/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MutableCluster } from "../cluster/mutation/MutableCluster.js";
import { WritableAttribute, Attribute, Command, TlvNoResponse, OptionalCommand } from "../cluster/Cluster.js";
import { TlvUInt16, TlvEnum } from "../tlv/TlvNumber.js";
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
import { AccessLevel } from "#model";
import { ClusterRegistry } from "../cluster/ClusterRegistry.js";
var Identify;
((Identify2) => {
  let IdentifyType;
  ((IdentifyType2) => {
    IdentifyType2[IdentifyType2["None"] = 0] = "None";
    IdentifyType2[IdentifyType2["LightOutput"] = 1] = "LightOutput";
    IdentifyType2[IdentifyType2["VisibleIndicator"] = 2] = "VisibleIndicator";
    IdentifyType2[IdentifyType2["AudibleBeep"] = 3] = "AudibleBeep";
    IdentifyType2[IdentifyType2["Display"] = 4] = "Display";
    IdentifyType2[IdentifyType2["Actuator"] = 5] = "Actuator";
  })(IdentifyType = Identify2.IdentifyType || (Identify2.IdentifyType = {}));
  Identify2.TlvIdentifyRequest = TlvObject({ identifyTime: TlvField(0, TlvUInt16) });
  let EffectIdentifier;
  ((EffectIdentifier2) => {
    EffectIdentifier2[EffectIdentifier2["Blink"] = 0] = "Blink";
    EffectIdentifier2[EffectIdentifier2["Breathe"] = 1] = "Breathe";
    EffectIdentifier2[EffectIdentifier2["Okay"] = 2] = "Okay";
    EffectIdentifier2[EffectIdentifier2["ChannelChange"] = 11] = "ChannelChange";
    EffectIdentifier2[EffectIdentifier2["FinishEffect"] = 254] = "FinishEffect";
    EffectIdentifier2[EffectIdentifier2["StopEffect"] = 255] = "StopEffect";
  })(EffectIdentifier = Identify2.EffectIdentifier || (Identify2.EffectIdentifier = {}));
  let EffectVariant;
  ((EffectVariant2) => {
    EffectVariant2[EffectVariant2["Default"] = 0] = "Default";
  })(EffectVariant = Identify2.EffectVariant || (Identify2.EffectVariant = {}));
  Identify2.TlvTriggerEffectRequest = TlvObject({
    /**
     * This field shall indicate the identify effect to use and shall contain one of the non-reserved values in
     * EffectIdentifierEnum.
     *
     * All values of the EffectIdentifierEnum shall be supported. Implementors may deviate from the example light
     * effects in EffectIdentifierEnum, but they SHOULD indicate during testing how they handle each effect.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.2.6.2.1
     */
    effectIdentifier: TlvField(0, TlvEnum()),
    /**
     * This field shall indicate which variant of the effect, indicated in the EffectIdentifier field, SHOULD be
     * triggered. If a device does not support the given variant, it shall use the default variant. This field shall
     * contain one of the values in EffectVariantEnum.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 1.2.6.2.2
     */
    effectVariant: TlvField(1, TlvEnum())
  });
  Identify2.ClusterInstance = MutableCluster({
    id: 3,
    name: "Identify",
    revision: 6,
    attributes: {
      /**
       * Indicates the remaining length of time, in seconds, that the endpoint will continue to identify itself.
       *
       * If this attribute is set to a value other than 0 then the device shall enter its identification state, in
       * order to indicate to an observer which of several nodes and/or endpoints it is. It is recommended that
       * this state consists of flashing a light with a period of 0.5 seconds. The IdentifyTime attribute shall be
       * decremented every second while in this state.
       *
       * If this attribute reaches or is set to the value 0 then the device shall terminate its identification
       * state.
       *
       * Changes to this attribute shall only be marked as reportable in the following cases:
       *
       *   • When it changes from 0 to any other value and vice versa, or
       *
       *   • When it is written by a client, or
       *
       *   • When the value is set by an Identify command.
       *
       * Since this attribute is not being reported during a regular countdown, clients SHOULD NOT rely on the
       * reporting of this attribute in order to keep track of the remaining duration.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.2.5.1
       */
      identifyTime: WritableAttribute(0, TlvUInt16),
      /**
       * Indicates how the identification state is presented to the user.
       *
       * This attribute shall contain one of the values defined in IdentifyTypeEnum. The value None shall NOT be
       * used if the device is capable of presenting its identification state using one of the other methods
       * defined in IdentifyTypeEnum.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.2.5.2
       */
      identifyType: Attribute(1, TlvEnum())
    },
    commands: {
      /**
       * This command starts or stops the receiving device identifying itself.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.2.6.1
       */
      identify: Command(0, Identify2.TlvIdentifyRequest, 0, TlvNoResponse, { invokeAcl: AccessLevel.Manage }),
      /**
       * This command allows the support of feedback to the user, such as a certain light effect. It is used to
       * allow an implementation to provide visual feedback to the user under certain circumstances such as a
       * color light turning green when it has successfully connected to a network. The use of this command and
       * the effects themselves are entirely up to the implementer to use whenever a visual feedback is useful but
       * it is not the same as and does not replace the identify mechanism used during commissioning.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 1.2.6.2
       */
      triggerEffect: OptionalCommand(
        64,
        Identify2.TlvTriggerEffectRequest,
        64,
        TlvNoResponse,
        { invokeAcl: AccessLevel.Manage }
      )
    }
  });
  Identify2.Cluster = Identify2.ClusterInstance;
  Identify2.Complete = Identify2.Cluster;
})(Identify || (Identify = {}));
const IdentifyCluster = Identify.Cluster;
ClusterRegistry.register(Identify.Complete);
export {
  Identify,
  IdentifyCluster
};
//# sourceMappingURL=identify.js.map
