import { formatPlannerEvents } from "../../../../zql/src/planner/planner-debug.js";
import { Client } from "./client.js";
class Inspector {
  #delegate;
  client;
  clientGroup;
  constructor(rep, inspectorDelegate, queryDelegate, getSocket) {
    this.#delegate = {
      getQueryMetrics: inspectorDelegate.getQueryMetrics.bind(inspectorDelegate),
      getAST: inspectorDelegate.getAST.bind(inspectorDelegate),
      mapClientASTToServer: inspectorDelegate.mapClientASTToServer.bind(inspectorDelegate),
      get metrics() {
        return inspectorDelegate.metrics;
      },
      queryDelegate,
      rep,
      getSocket,
      lazy: import("./lazy-inspector.js")
    };
    this.client = new Client(this.#delegate, rep.clientID, rep.clientGroupID);
    this.clientGroup = this.client.clientGroup;
  }
  async metrics() {
    return (await this.#delegate.lazy).inspectorMetrics(this.#delegate);
  }
  async clients() {
    return (await this.#delegate.lazy).inspectorClients(this.#delegate);
  }
  async clientsWithQueries() {
    return (await this.#delegate.lazy).inspectorClientsWithQueries(
      this.#delegate
    );
  }
  async serverVersion() {
    return (await this.#delegate.lazy).serverVersion(this.#delegate);
  }
  async analyzeQuery(query, options) {
    return (await this.#delegate.lazy).analyzeQuery(
      this.#delegate,
      query,
      options
    );
  }
  /**
   * Format planner debug events as a human-readable string.
   */
  formatPlannerEvents(events) {
    return formatPlannerEvents(events);
  }
}
export {
  Inspector
};
//# sourceMappingURL=inspector.js.map
