"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 wi_fi_network_management_exports = {};
__export(wi_fi_network_management_exports, {
  WiFiNetworkManagement: () => WiFiNetworkManagement,
  WiFiNetworkManagementCluster: () => WiFiNetworkManagementCluster
});
module.exports = __toCommonJS(wi_fi_network_management_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvString = require("../tlv/TlvString.js");
var import_TlvNullable = require("../tlv/TlvNullable.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_model = require("#model");
var import_TlvNoArguments = require("../tlv/TlvNoArguments.js");
var import_TlvObject = require("../tlv/TlvObject.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var WiFiNetworkManagement;
((WiFiNetworkManagement2) => {
  WiFiNetworkManagement2.TlvNetworkPassphraseResponse = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall indicate the current WPA-Personal passphrase or PSK associated with the primary Wi-Fi
     * network provided by this device, in one of the following formats:
     *
     *   • 8..63 bytes: WPA/WPA2/WPA3 passphrase.
     *
     *   • 64 bytes: WPA/WPA2/WPA3 raw hex PSK. Each byte shall be a ASCII hexadecimal digit.
     *
     * This matches the formats defined for WPA networks by the Credentials field in the Network Commissioning
     * cluster (see [MatterCore]).
     *
     * > [!NOTE]
     *
     * > WPA3-Personal permits passphrases shorter than 8 or longer than 63 characters, however the Network
     *   Commissioning cluster does not currently support configuring Matter devices to connect to operational
     *   networks utilizing such a passphrase.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 10.2.5.2.1
     */
    passphrase: (0, import_TlvObject.TlvField)(0, import_TlvString.TlvByteString.bound({ maxLength: 64 }))
  });
  WiFiNetworkManagement2.ClusterInstance = (0, import_MutableCluster.MutableCluster)({
    id: 1105,
    name: "WiFiNetworkManagement",
    revision: 1,
    attributes: {
      /**
       * Indicates the SSID of the primary Wi-Fi network provided by this device.
       *
       * A value of null shall indicate that no primary Wi-Fi network is available (e.g. because the Wi-Fi network
       * has not yet been configured by the user).
       *
       * > [!NOTE]
       *
       * > The SSID in Wi-Fi is a collection of 1-32 bytes, the text encoding of which is not specified.
       *   Implementations must be careful to support transferring these byte strings without requiring a
       *   particular encoding. The most common encoding is UTF-8, however this is just a convention. Some
       *   configurations may use Latin-1 or other character sets.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 10.2.4.1
       */
      ssid: (0, import_Cluster.Attribute)(
        0,
        (0, import_TlvNullable.TlvNullable)(import_TlvString.TlvByteString.bound({ minLength: 1, maxLength: 32 })),
        { persistent: true }
      ),
      /**
       * This attribute shall contain an arbitrary numeric value; this value shall increase whenever the
       * passphrase or PSK associated with the primary Wi-Fi network provided by this device changes.
       *
       * A value of null shall indicate that no primary Wi-Fi network is available.
       *
       * Clients can subscribe to this attribute or compare its value to a locally cached copy to detect if a
       * cached passphrase value has become stale.
       *
       * It is recommended that servers implement this attribute as either a timestamp or a counter. When
       * implemented as a counter it SHOULD be initialized with a random value.
       *
       * > [!NOTE]
       *
       * > The passphrase itself is not exposed as an attribute to avoid its unintentional retrieval or caching by
       *   clients that use wildcard reads or otherwise routinely read all available attributes. It can be
       *   retrieved using the NetworkPassphraseRequest command.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 10.2.4.2
       */
      passphraseSurrogate: (0, import_Cluster.Attribute)(
        1,
        (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvUInt64),
        { persistent: true, readAcl: import_model.AccessLevel.Manage, writeAcl: import_model.AccessLevel.Manage }
      )
    },
    commands: {
      /**
       * This command is used to request the current WPA-Personal passphrase or PSK associated with the Wi-Fi
       * network provided by this device.
       *
       * If the command is not executed via a CASE session, the command shall be rejected with a status of
       * UNSUPPORTED_ACCESS.
       *
       * If no primary Wi-Fi network is available (the SSID attribute is null), the command shall be rejected with
       * a status of INVALID_IN_STATE.
       *
       * Otherwise a NetworkPassphraseResponse shall be generated.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 10.2.5.1
       */
      networkPassphraseRequest: (0, import_Cluster.Command)(
        0,
        import_TlvNoArguments.TlvNoArguments,
        1,
        WiFiNetworkManagement2.TlvNetworkPassphraseResponse,
        { invokeAcl: import_model.AccessLevel.Manage }
      )
    }
  });
  WiFiNetworkManagement2.Cluster = WiFiNetworkManagement2.ClusterInstance;
  WiFiNetworkManagement2.Complete = WiFiNetworkManagement2.Cluster;
})(WiFiNetworkManagement || (WiFiNetworkManagement = {}));
const WiFiNetworkManagementCluster = WiFiNetworkManagement.Cluster;
import_ClusterRegistry.ClusterRegistry.register(WiFiNetworkManagement.Complete);
//# sourceMappingURL=wi-fi-network-management.js.map
