import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useMemo } from 'react';
import { Alert } from '@cube-dev/ui-kit';
import { useQueryBuilderContext } from '../context';
export function PreAggregationAlerts() {
    const { resultSet } = useQueryBuilderContext();
    const { external, 
    // dbType,
    extDbType, usedPreAggregations = {}, } = useMemo(() => {
        if (resultSet) {
            const { loadResponse } = resultSet?.serialize();
            return loadResponse.results[0] || {};
        }
        return {};
    }, [resultSet?.rawData()]);
    // @ts-ignore
    const preAggregationType = Object.values(usedPreAggregations || {})[0]?.type;
    const isAggregated = Object.keys(usedPreAggregations).length > 0;
    return (_jsxs(_Fragment, { children: [isAggregated && external && extDbType !== 'cubestore' ? (_jsx(Alert, { theme: "note", padding: "1x", children: "Consider migrating your pre-aggregations to Cube Store for better performance with larger datasets" })) : null, isAggregated && !external && preAggregationType !== 'originalSql' ? (_jsxs(Alert, { theme: "note", padding: "1x", children: ["For optimized performance, consider using ", _jsx("b", { children: "external" }), " ", preAggregationType, ' ', "pre-aggregation, rather than the source database (internal)"] })) : null] }));
}
//# sourceMappingURL=PreAggregationAlerts.js.map