"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 OperationalMdnsAdvertisement_exports = {};
__export(OperationalMdnsAdvertisement_exports, {
  OperationalMdnsAdvertisement: () => OperationalMdnsAdvertisement
});
module.exports = __toCommonJS(OperationalMdnsAdvertisement_exports);
var import_MdnsConsts = require("#mdns/MdnsConsts.js");
var import_general = require("@matter/general");
var import_MdnsAdvertisement = require("./MdnsAdvertisement.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class OperationalMdnsAdvertisement extends import_MdnsAdvertisement.MdnsAdvertisement {
  constructor(advertiser, description) {
    const {
      fabric: { globalId, nodeId }
    } = description;
    const qname = (0, import_MdnsConsts.getOperationalDeviceQname)(globalId, nodeId);
    super(advertiser, qname, description);
  }
  get ptrRecords() {
    const fabricQname = (0, import_MdnsConsts.getFabricQname)(this.description.fabric.globalId);
    return [
      (0, import_general.PtrRecord)(import_MdnsConsts.SERVICE_DISCOVERY_QNAME, import_MdnsConsts.MATTER_SERVICE_QNAME),
      (0, import_general.PtrRecord)(import_MdnsConsts.SERVICE_DISCOVERY_QNAME, fabricQname),
      (0, import_general.PtrRecord)(import_MdnsConsts.MATTER_SERVICE_QNAME, this.qname),
      (0, import_general.PtrRecord)(fabricQname, this.qname)
    ];
  }
  isDuplicate(other) {
    return other.isOperational() && other.service === this.service;
  }
}
//# sourceMappingURL=OperationalMdnsAdvertisement.js.map
