/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Diagnostic } from "@matter/general";
class DataModelPath {
  parent;
  id;
  type;
  constructor(id, type, parent) {
    this.id = id;
    this.type = type;
    this.parent = parent;
  }
  #identity(includeType) {
    if (this.type && includeType) {
      return `${this.type}#${this.id}`;
    }
    return this.id;
  }
  toString(includeType) {
    if (this.parent) {
      const sep = this.type === "marker" ? "" : ".";
      return `${this.parent.toString(includeType)}${sep}${this.#identity(includeType)}`;
    }
    return this.#identity(includeType).toString();
  }
  toArray() {
    if (this.parent) {
      return [...this.parent.toArray(), this.id];
    }
    return [this.id];
  }
  get [Diagnostic.presentation]() {
    return "squash";
  }
  get [Diagnostic.value]() {
    const result = Array();
    this.#appendDiagnostic(result);
    return result;
  }
  #appendDiagnostic(result) {
    if (this.parent) {
      this.parent.#appendDiagnostic(result);
      if (this.type !== "marker") {
        result.push(".");
      }
    }
    result.push(Diagnostic.strong(this.id));
  }
  at(id, type) {
    return new DataModelPath(id, type, this);
  }
  static none = new DataModelPath("none");
}
export {
  DataModelPath
};
//# sourceMappingURL=DataModelPath.js.map
