import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Spin, Typography, Alert, Space } from 'antd';
import { CheckCircleFilled } from '@ant-design/icons';
export default function ConnectionTest({ loading, result, }) {
    if (loading) {
        return (_jsxs(Space, { align: "center", size: "middle", children: [_jsx(Spin, { "data-testid": "wizard-test-connection-spinner" }), _jsx(Typography.Text, { children: "Testing database connection" })] }));
    }
    if (result?.success) {
        return (_jsxs(Typography.Text, { type: "success", children: [_jsx(CheckCircleFilled, {}), "\u00A0\u00A0Connection successful"] }));
    }
    if (result?.error) {
        return (_jsxs(_Fragment, { children: [_jsx(Typography.Text, { type: "danger", children: "We couldn\u2019t connect. Please double check the provided data and try again" }), _jsx(Alert, { "data-testid": "wizard-connection-error", style: { marginTop: 20 }, message: "Runtime Error", type: "error", description: (() => (_jsxs(_Fragment, { children: [_jsx("p", { style: { paddingLeft: 20 }, children: "Cube was unable to connect to the specified database." }), _jsx("p", { style: { paddingLeft: 20 }, children: "The database returned the following error:" }), _jsx("br", {}), _jsx("p", { style: { paddingLeft: 40 }, children: ">Database Error" }), _jsx("p", { style: { paddingLeft: 40 }, children: result.error.toString() }), _jsx("br", {}), _jsx("p", { children: "Check your database credentials and try again. For more information, visit:" }), _jsx("a", { href: "https://cube.dev/cube-core/getting-started/create-a-project", target: "_blank", children: "https://cube.dev/cube-core/getting-started/create-a-project" })] })))() })] }));
    }
    return null;
}
//# sourceMappingURL=ConnectionTest.js.map