"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSettingsValid = void 0;
const tslib_1 = require("tslib");
const Enums_1 = require("../../../../AdaptableState/Common/Enums");
const StringExtensions_1 = tslib_1.__importDefault(require("../../../../Utilities/Extensions/StringExtensions"));
const isSettingsValid = (schedule) => {
    if (schedule.ScheduleType === Enums_1.ScheduleType.Reminder) {
        const reminder = schedule;
        if (!reminder.MessageType) {
            return 'Message type not selected';
        }
        if (StringExtensions_1.default.IsNullOrEmpty(reminder?.Header)) {
            return 'Reminder header not specified';
        }
        if (StringExtensions_1.default.IsNullOrEmpty(reminder?.Message)) {
            return 'Reminder message not specified';
        }
    }
    if (schedule.ScheduleType === Enums_1.ScheduleType.Report) {
        const report = schedule;
        if (StringExtensions_1.default.IsNullOrEmpty(report?.ReportName)) {
            return 'Report source not specified';
        }
        if (StringExtensions_1.default.IsNullOrEmpty(report?.ReportFormat)) {
            return 'Report format not selected';
        }
    }
    if (schedule.ScheduleType === Enums_1.ScheduleType.ipushpull) {
        const ipushpull = schedule;
        if (StringExtensions_1.default.IsNullOrEmpty(ipushpull?.IPushPullReport?.ReportName)) {
            return 'Report not selected';
        }
        if (StringExtensions_1.default.IsNullOrEmpty(ipushpull?.IPushPullReport?.Folder)) {
            return 'Report folder not selected';
        }
        if (StringExtensions_1.default.IsNullOrEmpty(ipushpull?.IPushPullReport?.Page)) {
            return 'Report page not selected';
        }
    }
    if (schedule.ScheduleType === Enums_1.ScheduleType.OpenFin) {
        const openfin = schedule;
        if (StringExtensions_1.default.IsNullOrEmpty(openfin?.OpenFinReport?.ReportName)) {
            return 'Report not selected';
        }
    }
    return true;
};
exports.isSettingsValid = isSettingsValid;
