import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import Icon, { ThunderboltFilled } from '@ant-design/icons';
import { Alert, Button, Space, Typography } from 'antd';
import styled from 'styled-components';
import { useServerCoreVersionGte } from '../../../hooks';
import { useRollupDesignerContext } from '../../../rollup-designer';
const Badge = styled.div `
  display: flex;
  align-items: center;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--warning-bg-color);
`;
export function PreAggregationStatus({ isAggregated, external, extDbType, preAggregationType, }) {
    const isVersionGte = useServerCoreVersionGte('0.28.4');
    const { toggleModal } = useRollupDesignerContext();
    // hide it for the time being
    // const renderTime = () => (
    //   <Typography.Text strong style={{ color: 'rgba(20, 20, 70, 0.85)' }}>
    //     {formatNumber(timeElapsed)} ms
    //   </Typography.Text>
    // );
    return (_jsx(_Fragment, { children: _jsxs(Space, { style: { marginLeft: 'auto' }, children: [isAggregated && (_jsx(Badge, { children: _jsx(Space, { size: 4, children: _jsx(Icon, { style: { color: 'var(--warning-color)' }, component: () => _jsx(ThunderboltFilled, {}) }) }) })), isAggregated ? (_jsx(Typography.Text, { children: "Query was accelerated with pre-aggregation" })) : isVersionGte ? (_jsxs(Button, { "data-testid": "not-pre-agg-query-btn", type: "link", onClick: () => toggleModal(), children: ["Query was not accelerated with pre-aggregation ", '->'] })) : null, isAggregated && external && extDbType !== 'cubestore' ? (_jsx(Alert, { message: "Consider migrating your pre-aggregations to Cube Store for better performance with larger datasets", type: "warning" })) : null, isAggregated && !external && preAggregationType !== 'originalSql' ? (_jsx(Alert, { message: _jsxs(_Fragment, { children: ["For optimized performance, consider using ", _jsx("b", { children: "external" }), ' ', preAggregationType, " pre-aggregation, rather than the source database (internal)"] }), type: "warning" })) : null] }) }));
}
//# sourceMappingURL=PreAggregationStatus.js.map