"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScheduleSettingsWizard = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
const Enums_1 = require("../../../../AdaptableState/Common/Enums");
const ScheduleSettingsReminder_1 = require("./ScheduleSettingsReminder");
const ScheduleSettingsReport_1 = require("./ScheduleSettingsReport");
const ScheduleSettingsIPushPull_1 = require("./ScheduleSettingsIPushPull");
const ScheduleSettingsOpenFin_1 = require("./ScheduleSettingsOpenFin");
const ScheduleSettingsWizard = (props) => {
    const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
    const allReports = api.exportApi.getAllReports();
    if (data?.ScheduleType === Enums_1.ScheduleType.Reminder) {
        return (React.createElement(ScheduleSettingsReminder_1.ScheduleSettingsReminder, { reminderSchedule: data, onChange: props.onChange }));
    }
    if (data?.ScheduleType === Enums_1.ScheduleType.Report) {
        const allFormats = api.exportApi.getAvailableSystemFormats();
        const allDestinations = api.exportApi.getAllExportDestinations();
        return (React.createElement(ScheduleSettingsReport_1.ScheduleSettingsReport, { allReports: allReports ?? [], allFormats: allFormats ?? [], allDestinations: allDestinations ?? [], report: data, onChange: props.onChange }));
    }
    if (data?.ScheduleType === Enums_1.ScheduleType.ipushpull) {
        const ippApi = api.pluginsApi.getipushpullPluginApi();
        const allFolders = ippApi && ippApi.getIPushPullDomains();
        const folderName = data.IPushPullReport.Folder;
        const availablePages = ippApi && folderName && ippApi.getPagesForIPushPullDomain(folderName);
        return (React.createElement(ScheduleSettingsIPushPull_1.ScheduleSettingsIPushPull, { allReports: allReports || [], allFolders: allFolders || [], availablePages: availablePages || [], iPushPull: data, onChange: props.onChange }));
    }
    if (data?.ScheduleType === Enums_1.ScheduleType.OpenFin) {
        return (React.createElement(ScheduleSettingsOpenFin_1.ScheduleSettingsOpenFin, { allReports: allReports || [], openFin: data, onChange: props.onChange }));
    }
    return React.createElement(React.Fragment, null);
};
exports.ScheduleSettingsWizard = ScheduleSettingsWizard;
