"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const Day2WizardContext_1 = require("./Day2WizardContext");
const common_1 = require("../../../../common");
const Day2WizardFooter = ({ isSubmitting, isNextDisabled, onNext, onCancel, }) => {
    const wizardContext = (0, Day2WizardContext_1.useDay2WizardContext)();
    const { alerts, clearAlerts } = (0, common_1.useAlerts)();
    const disableNext = alerts.length > 0 || wizardContext.currentStepId === 'download-iso' || isNextDisabled;
    const closeWizard = react_1.default.useCallback(() => {
        clearAlerts();
        onCancel();
    }, [onCancel, clearAlerts]);
    const onBack = react_1.default.useCallback(() => {
        clearAlerts();
        wizardContext.moveBack();
    }, [wizardContext, clearAlerts]);
    return (react_1.default.createElement(common_1.WizardFooter, { alerts: alerts ? react_1.default.createElement(common_1.Alerts, null) : undefined, onNext: onNext || (() => wizardContext.moveNext()), onBack: onBack, isSubmitting: isSubmitting, isBackDisabled: wizardContext.currentStepId === 'cluster-details', isNextDisabled: disableNext, onCancel: closeWizard, "data-testid": "day2-wizard-footer" }));
};
exports.default = Day2WizardFooter;
//# sourceMappingURL=Day2WizardFooter.js.map