/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import {
  getFabricQname,
  getOperationalDeviceQname,
  MATTER_SERVICE_QNAME,
  SERVICE_DISCOVERY_QNAME
} from "#mdns/MdnsConsts.js";
import { PtrRecord } from "@matter/general";
import { MdnsAdvertisement } from "./MdnsAdvertisement.js";
class OperationalMdnsAdvertisement extends MdnsAdvertisement {
  constructor(advertiser, description) {
    const {
      fabric: { globalId, nodeId }
    } = description;
    const qname = getOperationalDeviceQname(globalId, nodeId);
    super(advertiser, qname, description);
  }
  get ptrRecords() {
    const fabricQname = getFabricQname(this.description.fabric.globalId);
    return [
      PtrRecord(SERVICE_DISCOVERY_QNAME, MATTER_SERVICE_QNAME),
      PtrRecord(SERVICE_DISCOVERY_QNAME, fabricQname),
      PtrRecord(MATTER_SERVICE_QNAME, this.qname),
      PtrRecord(fabricQname, this.qname)
    ];
  }
  isDuplicate(other) {
    return other.isOperational() && other.service === this.service;
  }
}
export {
  OperationalMdnsAdvertisement
};
//# sourceMappingURL=OperationalMdnsAdvertisement.js.map
