import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, Modal, ModalBody, ModalTitle, SelectBox, Spinner } from "@vertesia/ui/core";
import { useState } from "react";
export var ExportTypes;
(function (ExportTypes) {
    ExportTypes["CSV"] = "CSV";
    ExportTypes["JSON"] = "JSON";
})(ExportTypes || (ExportTypes = {}));
;
export function ExportPropertiesModal({ isExporting, isOpen, onClose }) {
    const title = "Export Object Properties";
    return (_jsxs(Modal, { onClose: () => onClose(undefined), isOpen: isOpen, className: "relative overflow-visible", children: [_jsx(ModalTitle, { children: title }), !isExporting &&
                _jsx(SelectPanel, { onClose: onClose }), isExporting &&
                _jsx(WaitingPanel, {})] }));
}
function SelectPanel({ onClose }) {
    const [exportType, setExportType] = useState(undefined);
    const [exportAll, setExportAll] = useState(undefined);
    const selectionOption = ["Export selected objects", "Export all objects"];
    const exportAllBoolean = (option) => {
        return option == selectionOption[1];
    };
    const onSubmit = () => {
        onClose(exportType, exportAllBoolean(exportAll));
    };
    return (_jsxs(ModalBody, { className: "min-h-[104px] pt-0 flex flex-col gap-y-4", children: [_jsx("div", { className: 'h-1/3', children: _jsx(SelectBox, { options: selectionOption, value: exportAll, onChange: setExportAll, placeholder: "Choose what to export", className: "h-full w-full text-sm", filterBy: "name", isClearable: true }) }), _jsxs("div", { className: 'h-1/2 flex flex-col gap-y-8 content-between', children: [_jsx(SelectBox, { options: Object.values(ExportTypes), value: exportType, onChange: setExportType, placeholder: "Choose a format", className: "h-full w-full text-sm", filterBy: "name", isClearable: true }), _jsx(Button, { className: "w-full", isDisabled: !exportType || !exportAll, onClick: onSubmit, children: "Export Properties" })] })] }));
}
function WaitingPanel({}) {
    return (_jsx(ModalBody, { className: "min-h-[84px] pt-0", children: _jsxs("div", { className: 'h-full grid flex-col gap-y-2 content-between justify-items-center', children: [_jsxs("div", { className: "text-sm flex flex-col gap-x-2", children: [_jsx("p", { children: "EXPORT IS IN PROGRESS" }), _jsx("p", { className: "pt-2 grid justify-items-center", children: "PLEASE WAIT" })] }), _jsx(Spinner, { size: 'lg' })] }) }));
}
//# sourceMappingURL=ExportPropertiesModal.js.map