"use strict";
/**
 * Qdrant vector DB RAG parser.
 * Detects Qdrant spans and returns standard RAGCall[].
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.qdrantRagParser = void 0;
const utils_1 = require("../utils");
const SYSTEM_NAME = 'qdrant';
const DB_SYSTEM = 'db.system';
const DB_SYSTEM_NAME = 'db.system.name';
function isQdrantSpan(span) {
    const attrs = span.attributes ?? {};
    const res = span.resourceAttributes ?? {};
    const sys = attrs[DB_SYSTEM_NAME] ?? attrs[DB_SYSTEM] ?? res[DB_SYSTEM_NAME] ?? res[DB_SYSTEM];
    if (sys != null && String(sys).toLowerCase().includes('qdrant'))
        return true;
    const name = (span.name ?? '').toLowerCase();
    const svc = (span.serviceName ?? '').toLowerCase();
    return name.includes('qdrant') || svc.includes('qdrant');
}
exports.qdrantRagParser = {
    name: 'qdrant',
    canParse(spans) {
        return (spans ?? []).some(isQdrantSpan);
    },
    parse(spans) {
        return (spans ?? [])
            .filter(isQdrantSpan)
            .map((span) => (0, utils_1.buildRAGCall)(span, { systemName: SYSTEM_NAME }));
    },
};
//# sourceMappingURL=qdrant.js.map