"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 ecosystem_information_exports = {};
__export(ecosystem_information_exports, {
  EcosystemInformation: () => EcosystemInformation,
  EcosystemInformationCluster: () => EcosystemInformationCluster
});
module.exports = __toCommonJS(ecosystem_information_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvArray = require("../tlv/TlvArray.js");
var import_TlvObject = require("../tlv/TlvObject.js");
var import_TlvString = require("../tlv/TlvString.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_EndpointNumber = require("../datatype/EndpointNumber.js");
var import_DeviceTypeId = require("../datatype/DeviceTypeId.js");
var import_FabricIndex = require("../datatype/FabricIndex.js");
var import_model = require("#model");
var import_Locationdesc = require("../globals/Locationdesc.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var EcosystemInformation;
((EcosystemInformation2) => {
  EcosystemInformation2.TlvDeviceType = (0, import_TlvObject.TlvObject)({
    /**
     * This shall indicate the device type definition.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.1.1
     */
    deviceType: (0, import_TlvObject.TlvField)(0, import_DeviceTypeId.TlvDeviceTypeId),
    /**
     * This is the implemented revision of the device type definition.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.1.2
     */
    revision: (0, import_TlvObject.TlvField)(1, import_TlvNumber.TlvUInt16.bound({ min: 1 }))
  });
  EcosystemInformation2.TlvEcosystemDevice = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the device’s name, which is provided externally if the user consents. (For example,
     * provided by the user in an ecosystem specific interface.)
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.2.1
     */
    deviceName: (0, import_TlvObject.TlvOptionalField)(0, import_TlvString.TlvString.bound({ maxLength: 64 })),
    /**
     * This field shall indicate the timestamp of when the DeviceName was last modified.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.2.2
     */
    deviceNameLastEdit: (0, import_TlvObject.TlvOptionalField)(1, import_TlvNumber.TlvEpochUs),
    /**
     * This field shall indicate the endpoint this EcosystemDeviceStruct is associated with on this Bridge.
     *
     * This field shall be present and set to a valid endpoint if the device is accessible through the bridge.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.2.3
     */
    bridgedEndpoint: (0, import_TlvObject.TlvOptionalField)(2, import_EndpointNumber.TlvEndpointNumber),
    /**
     * This field shall indicate the endpoint this EcosystemDeviceStruct is associated with on the original device
     * represented by this bridge’s Bridged Node. If this bridge is receiving the device from another bridge, then
     * the OriginalEndpoint field value would be the same on both bridges. This field shall be present and set to a
     * valid endpoint on the original device if that device is a Matter device.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.2.4
     */
    originalEndpoint: (0, import_TlvObject.TlvOptionalField)(3, import_EndpointNumber.TlvEndpointNumber),
    /**
     * This field shall indicate all of the DeviceTypes within the DeviceTypeList in the Descriptor Cluster
     * associated with this EcosystemDeviceStruct entry.
     *
     * This field shall contain a list of valid device type ids.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.2.5
     */
    deviceTypes: (0, import_TlvObject.TlvField)(4, (0, import_TlvArray.TlvArray)(EcosystemInformation2.TlvDeviceType)),
    /**
     * This field shall specify the EcosystemLocationStruct entries in the LocationDirectory attribute associated
     * with this EcosystemDeviceStruct.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.2.6
     */
    uniqueLocationIDs: (0, import_TlvObject.TlvField)(5, (0, import_TlvArray.TlvArray)(import_TlvString.TlvString, { maxLength: 64 })),
    /**
     * This field shall indicate the timestamp of when the UniqueLocationIDs was last modified.
     *
     * > [!NOTE]
     *
     * > If multiple server instances update the UniqueLocationIDs field at the same time, it is possible one of the
     *   updates will be missed. This is considered an acceptable limitation to reduce the complexity of the design.
     *   Since this is meant to be provided from user input, it is unlikely these signals would be happening at one
     *   time.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.2.7
     */
    uniqueLocationIDsLastEdit: (0, import_TlvObject.TlvField)(6, import_TlvNumber.TlvEpochUs),
    fabricIndex: (0, import_TlvObject.TlvField)(254, import_FabricIndex.TlvFabricIndex)
  });
  EcosystemInformation2.TlvEcosystemLocation = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate a unique identifier for a specific Ecosystem Information Cluster server instance
     * representing the location independent of its LocationDescriptor field.
     *
     * UniqueLocationID can be used by the client to determine if the change is a relocation of the device or just a
     * renaming of the location.
     *
     * No guarantees are given for consistency of the ID between server instances. The same location may be
     * represented by different IDs on different Ecosystem Information Cluster server instances, so only the history
     * from a single server instance should be considered when evaluating a change.
     *
     * UniqueLocationID shall be changed when the LocationDescriptor changes from one existing location to another
     * location as a result of an external interaction. (For example, the user changes the location assignment.)
     *
     * UniqueLocationID shall NOT be changed when the LocationDescriptor changes name, but still represents the same
     * location. (For example, the user renames a room.) UniqueLocationID shall be changed when LocationDescriptor
     * changes as a result of another Ecosystem Information Cluster server instance changing and the
     * UniqueLocationID on the remote server instance also changes.
     *
     * UniqueLocationID shall NOT be changed when LocationDescriptor changes as a result of another Ecosystem
     * Information Cluster server instance changing and the UniqueLocationID on the remote server instance does not
     * change.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.3.1
     */
    uniqueLocationId: (0, import_TlvObject.TlvField)(0, import_TlvString.TlvString.bound({ maxLength: 64 })),
    /**
     * This field shall indicate the location (e.g. living room, driveway) and associated metadata that is provided
     * externally if the user consents. (For example, provided by the user in an ecosystem specific interface.)
     *
     * "Location" in this context is typically used by the user’s grouping into rooms, areas or other logical
     * groupings of how devices are used. So a device might be part of multiple such "Locations"s.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.3.2
     */
    locationDescriptor: (0, import_TlvObject.TlvField)(1, import_Locationdesc.TlvLocationdesc),
    /**
     * This field shall indicate the timestamp of when the LocationDescriptor was last modified.
     *
     * @see {@link MatterSpecification.v142.Core} § 9.17.4.3.3
     */
    locationDescriptorLastEdit: (0, import_TlvObject.TlvField)(2, import_TlvNumber.TlvEpochUs),
    fabricIndex: (0, import_TlvObject.TlvField)(254, import_FabricIndex.TlvFabricIndex)
  });
  EcosystemInformation2.ClusterInstance = (0, import_MutableCluster.MutableCluster)({
    id: 1872,
    name: "EcosystemInformation",
    revision: 1,
    attributes: {
      /**
       * This attribute shall contain the list of logical devices represented by a Bridged Node. Most of the time
       * this will contain a single entry, but may grow with more complex device compositions (e.g. another
       * bridge.) An empty list indicates that the information is not available.
       *
       * @see {@link MatterSpecification.v142.Core} § 9.17.5.1
       */
      deviceDirectory: (0, import_Cluster.FabricScopedAttribute)(
        0,
        (0, import_TlvArray.TlvArray)(EcosystemInformation2.TlvEcosystemDevice),
        { persistent: true, default: [], readAcl: import_model.AccessLevel.Manage, writeAcl: import_model.AccessLevel.Manage }
      ),
      /**
       * This attribute shall contain the list of rooms, areas and groups associated with the DeviceDirectory
       * entries, and shall NOT contain locations which are dynamically generated and removed by anecosystem.
       * (E.g. a location that is generated and removed based on the user being home is notpermitted. However, an
       * initially generated location name that does not quickly change is acceptable.) An empty list indicates
       * that the information is not available.
       *
       * LocationDirectory entries shall be removed if there is no DeviceDirectory that references it.
       *
       * @see {@link MatterSpecification.v142.Core} § 9.17.5.2
       */
      locationDirectory: (0, import_Cluster.FabricScopedAttribute)(
        1,
        (0, import_TlvArray.TlvArray)(EcosystemInformation2.TlvEcosystemLocation),
        { persistent: true, default: [], readAcl: import_model.AccessLevel.Manage, writeAcl: import_model.AccessLevel.Manage }
      )
    }
  });
  EcosystemInformation2.Cluster = EcosystemInformation2.ClusterInstance;
  EcosystemInformation2.Complete = EcosystemInformation2.Cluster;
})(EcosystemInformation || (EcosystemInformation = {}));
const EcosystemInformationCluster = EcosystemInformation.Cluster;
import_ClusterRegistry.ClusterRegistry.register(EcosystemInformation.Complete);
//# sourceMappingURL=ecosystem-information.js.map
