"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 basic_information_validators_exports = {};
__export(basic_information_validators_exports, {
  CHIP_DUMMY_MANUFACTURE_DATE: () => CHIP_DUMMY_MANUFACTURE_DATE,
  validateBasicInfoAttributes: () => validateBasicInfoAttributes
});
module.exports = __toCommonJS(basic_information_validators_exports);
var import_general = require("@matter/general");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
const CHIP_DUMMY_MANUFACTURE_DATE = "20200101";
function validateBasicInfoAttributes(state, log) {
  const { uniqueId, serialNumber, vendorName, productLabel, manufacturingDate, vendorId, productId } = state;
  if (vendorId !== void 0 && (vendorId === 0 || vendorId > 65524)) {
    throw new import_general.ImplementationError(
      `VendorID 0x${vendorId.toString(16).padStart(4, "0")} is not a valid device identity; it must be in 0x0001-0xFFF4`
    );
  }
  if (productId === 0) {
    throw new import_general.ImplementationError("ProductID 0x0000 is reserved and may not be assigned to a product");
  }
  if (uniqueId !== void 0 && serialNumber !== void 0 && uniqueId === serialNumber) {
    log.warn("uniqueId and serialNumber shall not be the same");
  }
  if (vendorName !== void 0) {
    if (vendorName.trim().length === 0) {
      log.warn("vendorName shall not be empty");
    } else if (productLabel !== void 0 && productLabel.includes(vendorName)) {
      log.warn("productLabel should not include vendorName");
    }
  }
  if (manufacturingDate === CHIP_DUMMY_MANUFACTURE_DATE) {
    log.warn(`manufacturingDate "${CHIP_DUMMY_MANUFACTURE_DATE}" looks like a placeholder/example value`);
  }
}
//# sourceMappingURL=basic-information-validators.js.map
