import { RetryConfig } from '../utils/resilience.js';

/**
 * Type definitions for codebase search tool
 */

interface CodebaseSearchConfig {
    repoId: string;
    /** Optional branch name (e.g., 'main', 'develop'). Uses latest commit for that branch. */
    branch?: string;
    /** Optional commit hash. If specified, uses this exact commit. Takes precedence over branch. */
    commitHash?: string;
    searchUrl?: string;
    apiKey?: string;
    /** Timeout for search requests in ms (default: 30000) */
    timeout?: number;
    /** Retry configuration for API calls */
    retryConfig?: RetryConfig;
    /** Enable debug logging (default: false) */
    debug?: boolean;
}
interface CodebaseSearchInput {
    query: string;
    target_directories?: string[];
    explanation?: string;
    limit?: number;
}
interface CodeSearchResult {
    filepath: string;
    symbolPath: string;
    content: string;
    language: string;
    startLine: number;
    endLine: number;
    embeddingSimilarity: number;
    rerankScore: number;
}
interface SearchStats {
    totalResults: number;
    candidatesRetrieved: number;
    searchTimeMs: number;
}
interface CodebaseSearchResult {
    success: boolean;
    results: CodeSearchResult[];
    stats: SearchStats;
    error?: string;
}

export type { CodeSearchResult, CodebaseSearchConfig, CodebaseSearchInput, CodebaseSearchResult, SearchStats };
