import React from 'react';
import Step1Complete from 'src/components/bulkUploadSidebar/step1Description/step1Complete';
import Step1Invalid from 'src/components/bulkUploadSidebar/step1Description/step1Invalid';
import Step1Upload from 'src/components/bulkUploadSidebar/step1Description/step1Upload';
import { BULK_CREATION_STEPS } from 'src/constants';

const Step1Description = ({
    activeStep,
    hasColumnErrors,
    hasOutdatedTemplate,
    onDownloadReport,
    showRetryButton,
    isMetadataRetry,
    onRetry,
    originalFilename,
    templateDownloadLink,
    classicalTemplateDownloadLink,
}: {
    activeStep: BULK_CREATION_STEPS;
    hasColumnErrors: boolean;
    hasOutdatedTemplate: boolean;
    onDownloadReport: () => void;
    showRetryButton: boolean;
    isMetadataRetry: boolean;
    onRetry: () => void;
    originalFilename: string | undefined;
    templateDownloadLink: string | null;
    classicalTemplateDownloadLink: string | null;
}) => {
    if (hasColumnErrors)
        return (
            <Step1Invalid
                onDownloadReport={
                    hasOutdatedTemplate ? onDownloadReport : undefined
                }
                hasOutdatedTemplate={hasOutdatedTemplate}
                hasGenericColumnErrors={!hasOutdatedTemplate}
                templateDownloadLink={templateDownloadLink}
                classicalTemplateDownloadLink={classicalTemplateDownloadLink}
            />
        );
    else if (activeStep === BULK_CREATION_STEPS.METADATA_UPLOAD)
        return (
            <Step1Upload
                templateDownloadLink={templateDownloadLink}
                classicalTemplateDownloadLink={classicalTemplateDownloadLink}
            />
        );
    else if (activeStep === BULK_CREATION_STEPS.METADATA_INVALID)
        return (
            <Step1Invalid
                onDownloadReport={onDownloadReport}
                showRetryButton={showRetryButton}
                isMetadataRetry={isMetadataRetry}
                onRetry={onRetry}
                originalFilename={originalFilename}
            />
        );
    else return <Step1Complete />;
};

export default Step1Description;
