"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 FormLayout_1 = tslib_1.__importStar(require("../../../../components/FormLayout"));
const Input_1 = tslib_1.__importDefault(require("../../../../components/Input"));
const Select_1 = require("../../../../components/Select");
const Tabs_1 = require("../../../../components/Tabs");
const Flex_1 = require("../../../../components/Flex");
const ScheduleSettingsReport = (props) => {
    const handleNameChange = (event) => {
        props.onChange({
            ...props.report,
            Name: event.target.value,
        });
    };
    const reportOptions = props.allReports.map((report) => ({
        label: report.Name,
        value: report.Name,
    }));
    const formatOptions = props.allFormats.map((reportFormat) => ({
        label: reportFormat,
        value: reportFormat,
        onClick: () => {
            props.onChange({
                ...props.report,
                ReportFormat: reportFormat,
            });
        },
    }));
    const destinationOptions = props.allDestinations.map((destination) => ({
        label: destination,
        value: destination,
        onClick: () => {
            props.onChange({
                ...props.report,
                ExportDestination: destination,
            });
        },
    }));
    return (React.createElement(Flex_1.Box, { "data-name": "schedule-settings-report" },
        React.createElement(Tabs_1.Tabs, { autoFocus: false, className: "twa:mb-3" },
            React.createElement(Tabs_1.Tabs.Tab, null, "Settings"),
            React.createElement(Tabs_1.Tabs.Content, null,
                React.createElement(FormLayout_1.default, null,
                    React.createElement(FormLayout_1.FormRow, { label: "Name" },
                        React.createElement(Input_1.default, { "data-name": "schedule-name", className: "twa:w-[300px]", onChange: handleNameChange, placeholder: "Enter Schedule Name", type: "string", value: props.report?.Name ?? '' })),
                    React.createElement(FormLayout_1.FormRow, { label: "" },
                        React.createElement(Flex_1.Box, { className: "twa:h-2" })),
                    React.createElement(FormLayout_1.FormRow, { label: "Export" },
                        React.createElement(Flex_1.Box, { className: "twa:max-w-[300px]" },
                            React.createElement(Select_1.Select, { "data-name": "select-report", options: reportOptions, value: props?.report?.ReportName, placeholder: "Select Export", onChange: (value) => props.onChange({
                                    ...props.report,
                                    ReportName: value,
                                }) }))),
                    React.createElement(FormLayout_1.FormRow, { label: "Format" },
                        React.createElement(Flex_1.Box, { className: "twa:max-w-[300px]" },
                            React.createElement(Select_1.Select, { "data-name": "select-format", options: formatOptions, value: props?.report?.ReportFormat, placeholder: "Select Format", onChange: (value) => props.onChange({
                                    ...props.report,
                                    ReportFormat: value,
                                }) }))),
                    React.createElement(FormLayout_1.FormRow, { label: "Destination" },
                        React.createElement(Flex_1.Box, { className: "twa:max-w-[300px]" },
                            React.createElement(Select_1.Select, { "data-name": "select-destination", options: destinationOptions, value: props?.report?.ExportDestination, placeholder: "Select Format", onChange: (value) => props.onChange({
                                    ...props.report,
                                    ExportDestination: value,
                                }) }))))))));
};
exports.ScheduleSettingsReport = ScheduleSettingsReport;
