import { Box, Text, TextButton, } from '@wix/design-system';
import React from 'react';
import { ExportStepConfig } from './ExportStepConfig';
import { ExportStepProgress } from './ExportStepProgress';
import { ExportStepError } from './ExportStepError';
import { ExportStepCancel } from './ExportStepCancel';
import { getExportModalErrorProps, } from './getExportModalErrorProps';
export function getExportModalStepProps({ state, renderError, exportModalFooter, exportModalTitle, exportToCSVMessage, onProgressModalTitle, }) {
    const { currentStep, translate: t } = state;
    if (currentStep === 'cancel') {
        return {
            title: t('cairo.export.cancelTheExport'),
            children: React.createElement(ExportStepCancel, { state: state }),
            primaryButtonText: t('cairo.export.cancelTheExportConfirm'),
            secondaryButtonText: t('cairo.export.cancelTheExportGoBack'),
            secondaryButtonProps: { skin: 'destructive' },
            primaryButtonProps: { skin: 'destructive', disabled: false },
            primaryButtonOnClick: () => state.onCancelExportVerifyButtonClick(),
            secondaryButtonOnClick: state.onCancelExportGoBackButtonClick,
            closeButtonProps: { onClick: state.onCancelExportCloseButtonClick, autoFocus: true },
            onRequestClose: state.onCancelExportCloseButtonClick,
        };
    }
    if (currentStep === 'config') {
        return {
            title: exportModalTitle || t('cairo.export.exportTypeQuestionTitle'),
            children: (React.createElement(ExportStepConfig, { state: state, exportToCSVMessage: exportToCSVMessage })),
            primaryButtonText: t('cairo.export.export'),
            primaryButtonOnClick: state.onExportToClick,
            secondaryButtonText: t('cairo.export.cancelButton'),
            secondaryButtonOnClick: state.onCancelClick,
            closeButtonProps: { onClick: state.onCloseClick, autoFocus: true },
            onRequestClose: state.onCloseClick,
            footnote: exportModalFooter ? (React.createElement(Text, { dataHook: "export-modal-footer-text", size: "small" }, exportModalFooter?.text)) : null,
        };
    }
    if (currentStep === 'error') {
        const modalProps = getExportModalErrorProps({ state, renderError });
        return {
            title: t('cairo.export.exportFailed'),
            secondaryButtonText: t('cairo.export.cancelButton'),
            secondaryButtonOnClick: state.onFailedCancel,
            closeButtonProps: { onClick: state.onFailedClose, autoFocus: true },
            onRequestClose: state.onFailedClose,
            primaryButtonText: t('Got It'),
            primaryButtonOnClick: state.onFailedClose,
            ...modalProps,
            children: (React.createElement(ExportStepError, { state: state }, modalProps.children ?? (React.createElement(Box, { direction: "vertical" },
                React.createElement(Text, { widows: true }, t('cairo.export.serverErrorMessage')),
                React.createElement(TextButton, { dataHook: "export-error-message-action", as: "a", onClick: state.onRetryExportToClick }, t('cairo.export.tryAgain')))))),
        };
    }
    // exporting
    return {
        title: onProgressModalTitle || t('cairo.export.exportingTitle'),
        children: React.createElement(ExportStepProgress, { state: state }),
        primaryButtonText: t('cairo.export.exporting'),
        primaryButtonProps: {
            disabled: true,
        },
        closeButtonProps: { onClick: state.onExportCloseAttemptClick, autoFocus: true },
        onRequestClose: state.onExportCloseAttemptClick,
        secondaryButtonText: t('cairo.export.cancelButton'),
        secondaryButtonOnClick: state.onExportSecondaryActionAttempt,
    };
}
//# sourceMappingURL=getExportModalStepProps.js.map