/**
 * @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) {
      return `${this.parent}.${this.#identity(includeType)}`;
    }
    return this.#identity(includeType).toString();
  }
  toArray() {
    if (this.parent) {
      return [...this.parent.toArray(), this.id];
    }
    return [this.id];
  }
  get [Diagnostic.value]() {
    const result = Array();
    for (const segment of this.toArray()) {
      if (result.length) {
        result.push(".");
      }
      result.push(Diagnostic.strong(segment));
    }
    return Diagnostic.squash(result);
  }
  at(id, type) {
    return new DataModelPath(id, type, this);
  }
  static none = new DataModelPath("none");
}
export {
  DataModelPath
};
//# sourceMappingURL=DataModelPath.js.map
