import { collectDependencies } from '../detection-utils.js';
const ALGOLIA_DEPS = [
    'algoliasearch',
    '@algolia/client-search',
    'algolia',
    'django-algolia',
    'scout-extended',
];
const TYPESENSE_DEPS = ['typesense', 'typesense-js', 'typesense-python'];
const MEILISEARCH_DEPS = [
    'meilisearch',
    'meilisearch-js',
    'meilisearch-python',
    'meilisearch-ruby',
];
const OPENSEARCH_DEPS = ['@opensearch-project/opensearch', 'opensearch-py', 'opensearchgo'];
const ELASTICSEARCH_DEPS = [
    '@elastic/elasticsearch',
    'elasticsearch-py',
    'elasticsearch',
    'olivere/elastic',
    'elastic/go-elasticsearch',
    'elasticsearch-rs',
    'elasticsearch-ruby',
    'chewy',
];
export async function detectSearchEngine(projectPath) {
    const deps = await collectDependencies(projectPath);
    // Algolia (most specific deps)
    if (ALGOLIA_DEPS.some((d) => deps.has(d))) {
        return 'algolia';
    }
    // Typesense
    if (TYPESENSE_DEPS.some((d) => deps.has(d))) {
        return 'typesense';
    }
    // Meilisearch
    if (MEILISEARCH_DEPS.some((d) => deps.has(d))) {
        return 'meilisearch';
    }
    // OpenSearch (before Elasticsearch — shares some patterns)
    if (OPENSEARCH_DEPS.some((d) => deps.has(d))) {
        return 'opensearch';
    }
    // Elasticsearch
    if (ELASTICSEARCH_DEPS.some((d) => deps.has(d))) {
        return 'elasticsearch';
    }
    return null;
}
//# sourceMappingURL=search-engine-detector.js.map