"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScheduleSettingsReport = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const rebass_1 = require("rebass");
const FormLayout_1 = tslib_1.__importStar(require("../../../../components/FormLayout"));
const Select_1 = require("../../../../components/Select");
const Tabs_1 = require("../../../../components/Tabs");
const DESTINATIONS = ['Excel', 'CSV', 'Clipboard', 'JSON'];
const ScheduleSettingsReport = (props) => {
    var _a, _b;
    const reportOptions = props.allReports.map((report) => ({
        label: report.Name,
        value: report.Name,
    }));
    const customDestinationNames = props.customDestinations.map((destination) => destination.name);
    const destinationOptions = [...DESTINATIONS, ...customDestinationNames].map((destination) => ({
        label: destination,
        value: destination,
        onClick: () => {
            props.onChange(Object.assign(Object.assign({}, props.report), { ExportDestination: destination }));
        },
    }));
    return (React.createElement(rebass_1.Box, { "data-name": "schedule-settings-report" },
        React.createElement(Tabs_1.Tabs, { autoFocus: false, mb: 3 },
            React.createElement(Tabs_1.Tabs.Tab, null, "Report Schedule Settings"),
            React.createElement(Tabs_1.Tabs.Content, null,
                React.createElement(FormLayout_1.default, null,
                    React.createElement(FormLayout_1.FormRow, { label: "Export" },
                        React.createElement(rebass_1.Box, { maxWidth: 300 },
                            React.createElement(Select_1.Select, { "data-name": "select-export", options: reportOptions, value: (_a = props === null || props === void 0 ? void 0 : props.report) === null || _a === void 0 ? void 0 : _a.ReportName, placeholder: "Select Export", onChange: (value) => props.onChange(Object.assign(Object.assign({}, props.report), { ReportName: value })) }))),
                    React.createElement(FormLayout_1.FormRow, { label: "Destination" },
                        React.createElement(rebass_1.Box, { maxWidth: 300 },
                            React.createElement(Select_1.Select, { "data-name": "select-destination", options: destinationOptions, value: (_b = props === null || props === void 0 ? void 0 : props.report) === null || _b === void 0 ? void 0 : _b.ExportDestination, placeholder: "Select Destination", onChange: (value) => props.onChange(Object.assign(Object.assign({}, props.report), { ExportDestination: value })) }))))))));
};
exports.ScheduleSettingsReport = ScheduleSettingsReport;
