/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { isDeepEqual } from "@matter/general";
import { PeerAddress } from "./PeerAddress.js";
class ObservablePeerDescriptor {
  #address;
  #operationalAddress;
  #discoveryData;
  #caseAuthenticatedTags;
  #sessionParameters;
  #onChange;
  constructor({ address, operationalAddress, discoveryData, caseAuthenticatedTags }, onChange) {
    this.#address = PeerAddress(address);
    this.#operationalAddress = operationalAddress;
    this.#discoveryData = discoveryData;
    this.#caseAuthenticatedTags = caseAuthenticatedTags;
    this.#onChange = onChange;
  }
  get address() {
    return this.#address;
  }
  get operationalAddress() {
    return this.#operationalAddress;
  }
  set operationalAddress(value) {
    if (isDeepEqual(this.#operationalAddress, value)) {
      return;
    }
    this.#operationalAddress = value ? { ...value } : void 0;
    this.#onChange();
  }
  get discoveryData() {
    return this.#discoveryData;
  }
  set discoveryData(value) {
    if (isDeepEqual(value, this.#discoveryData)) {
      return;
    }
    this.#discoveryData = { ...this.#discoveryData, ...value };
    this.#onChange();
  }
  get sessionParameters() {
    return this.#sessionParameters;
  }
  set sessionParameters(value) {
    if (value === void 0 || isDeepEqual(value, this.#sessionParameters)) {
      return;
    }
    this.#sessionParameters = { ...value };
    this.#onChange();
  }
  get caseAuthenticatedTags() {
    return this.#caseAuthenticatedTags;
  }
  set caseAuthenticatedTags(cats) {
    if (isDeepEqual(cats, this.#caseAuthenticatedTags)) {
      return;
    }
    this.#caseAuthenticatedTags = cats ? [...cats] : void 0;
    this.#onChange();
  }
}
export {
  ObservablePeerDescriptor
};
//# sourceMappingURL=PeerDescriptor.js.map
