/**
 * ClangdClient - LSP query interface via clangd
 * DD §15. Uses compile_commands.json for context-aware queries.
 *
 * @module packages/toolchain-cpp/src/analysis/ClangdClient
 */

export interface ClangdQueryOutput {
  ok: boolean
  symbols?: Array<{ name: string; kind: string; file: string; line: number }>
  diagnostics?: Array<{ file: string; line: number; message: string; severity: string }>
  error?: string
}

export class ClangdClient {
  private compile_commands_path: string | null

  constructor(compile_commands_path?: string) {
    this.compile_commands_path = compile_commands_path || null
  }

  /**
   * Query a symbol definition using clangd.
   * TODO(P5): Implement LSP protocol communication with clangd.
   */
  async query_symbol(file: string, line: number, column: number): Promise<ClangdQueryOutput> {
    // STUB: Would start clangd, send textDocument/definition request
    return { ok: false, error: 'Clangd LSP client not yet implemented' }
  }

  /**
   * Query diagnostics for a file.
   * TODO(P5): Implement textDocument/diagnostic LSP request.
   */
  async query_diagnostics(file: string): Promise<ClangdQueryOutput> {
    return { ok: false, error: 'Diagnostics query not yet implemented' }
  }
}
