/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { MutableCluster } from "../cluster/mutation/MutableCluster.js";
import {
  OptionalFixedAttribute,
  OptionalWritableAttribute,
  Attribute,
  OptionalEvent,
  EventPriority,
  Event
} from "../cluster/Cluster.js";
import { TlvString } from "../tlv/TlvString.js";
import { TlvVendorId } from "../datatype/VendorId.js";
import { AccessLevel } from "#model";
import { TlvUInt16, TlvUInt32 } from "../tlv/TlvNumber.js";
import { TlvBoolean } from "../tlv/TlvBoolean.js";
import { BasicInformation } from "./basic-information.js";
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
import { TlvNoArguments } from "../tlv/TlvNoArguments.js";
import { ClusterRegistry } from "../cluster/ClusterRegistry.js";
var BridgedDeviceBasicInformation;
((BridgedDeviceBasicInformation2) => {
  BridgedDeviceBasicInformation2.TlvStartUpEvent = TlvObject({
    /**
     * This field shall be set to the same value as the one available in the SoftwareVersion attribute.
     *
     * @see {@link MatterSpecification.v13.Core} § 11.1.6.1.1
     */
    softwareVersion: TlvField(0, TlvUInt32)
  });
  BridgedDeviceBasicInformation2.TlvReachableChangedEvent = TlvObject({
    /**
     * This field shall indicate the value of the Reachable attribute after it was changed.
     *
     * @see {@link MatterSpecification.v13.Core} § 11.1.6.4.1
     */
    reachableNewValue: TlvField(0, TlvBoolean)
  });
  BridgedDeviceBasicInformation2.ClusterInstance = MutableCluster({
    id: 57,
    name: "BridgedDeviceBasicInformation",
    revision: 3,
    attributes: {
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      vendorName: OptionalFixedAttribute(1, TlvString.bound({ maxLength: 32 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      vendorId: OptionalFixedAttribute(2, TlvVendorId),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      productName: OptionalFixedAttribute(3, TlvString.bound({ maxLength: 32 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      nodeLabel: OptionalWritableAttribute(
        5,
        TlvString.bound({ maxLength: 32 }),
        { persistent: true, writeAcl: AccessLevel.Manage }
      ),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      hardwareVersion: OptionalFixedAttribute(7, TlvUInt16),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      hardwareVersionString: OptionalFixedAttribute(8, TlvString.bound({ minLength: 1, maxLength: 64 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      softwareVersion: OptionalFixedAttribute(9, TlvUInt32),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      softwareVersionString: OptionalFixedAttribute(10, TlvString.bound({ minLength: 1, maxLength: 64 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      manufacturingDate: OptionalFixedAttribute(11, TlvString.bound({ minLength: 8, maxLength: 16 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      partNumber: OptionalFixedAttribute(12, TlvString.bound({ maxLength: 32 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      productUrl: OptionalFixedAttribute(13, TlvString.bound({ maxLength: 256 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      productLabel: OptionalFixedAttribute(14, TlvString.bound({ maxLength: 64 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      serialNumber: OptionalFixedAttribute(15, TlvString.bound({ maxLength: 32 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      reachable: Attribute(17, TlvBoolean),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      uniqueId: OptionalFixedAttribute(18, TlvString.bound({ maxLength: 32 })),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.4
       */
      productAppearance: OptionalFixedAttribute(20, BasicInformation.TlvProductAppearance)
    },
    events: {
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.5
       */
      startUp: OptionalEvent(0, EventPriority.Critical, BridgedDeviceBasicInformation2.TlvStartUpEvent),
      /**
       * @see {@link MatterSpecification.v13.Core} § 9.13.5
       */
      shutDown: OptionalEvent(1, EventPriority.Critical, TlvNoArguments),
      /**
       * The Leave event SHOULD be generated by the bridge when it detects that the associated device has left
       * the non-Matter network.
       *
       * NOTE
       *
       * The FabricIndex field has the X conformance, indicating it shall NOT be present. This event, in the
       * context of Bridged Device Basic Information cluster, has no usable fields, but the original Basic
       * Information cluster’s field definition is kept for completeness.
       *
       * @see {@link MatterSpecification.v13.Core} § 9.13.5.1
       */
      leave: OptionalEvent(2, EventPriority.Critical, TlvNoArguments),
      /**
       * This event shall be generated when there is a change in the Reachable attribute. Its purpose is to
       * provide an indication towards interested parties that the reachability of a bridged device (over the
       * non-Matter network) has changed, so they may take appropriate action.
       *
       * After (re)start of a bridge this event may be generated.
       *
       * @see {@link MatterSpecification.v13.Core} § 9.13.5.2
       */
      reachableChanged: Event(3, EventPriority.Critical, BridgedDeviceBasicInformation2.TlvReachableChangedEvent)
    }
  });
  BridgedDeviceBasicInformation2.Cluster = BridgedDeviceBasicInformation2.ClusterInstance;
  BridgedDeviceBasicInformation2.Complete = BridgedDeviceBasicInformation2.Cluster;
})(BridgedDeviceBasicInformation || (BridgedDeviceBasicInformation = {}));
const BridgedDeviceBasicInformationCluster = BridgedDeviceBasicInformation.Cluster;
ClusterRegistry.register(BridgedDeviceBasicInformation.Complete);
export {
  BridgedDeviceBasicInformation,
  BridgedDeviceBasicInformationCluster
};
//# sourceMappingURL=bridged-device-basic-information.js.map
