"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExportDropdown = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const DropdownButton_1 = tslib_1.__importDefault(require("../../../components/DropdownButton"));
const handleExportState_1 = require("../handleExportState");
const ExportDropdown = (props) => {
    const handleChange = (destination) => {
        switch (props.type) {
            case 'adaptableState':
                const adaptableState = props.api.stateApi.getPersistentState();
                (0, handleExportState_1.handleExportState)(destination, 'adaptableState', adaptableState);
                break;
            case 'initialState':
                const initialState = props.api.stateApi.getInitialState();
                (0, handleExportState_1.handleExportState)(destination, 'initialState', initialState);
                break;
        }
    };
    const destinationOptions = [
        {
            value: 'Clipboard',
            label: 'Clipboard',
            onClick: () => handleChange('Clipboard'),
        },
        {
            value: 'Console',
            label: 'Console',
            onClick: () => handleChange('Console'),
        },
        {
            value: 'JSON',
            label: 'JSON',
            onClick: () => handleChange('JSON'),
        },
    ];
    return (React.createElement(DropdownButton_1.default, { className: "ab-StateManagement__Export-Dropdown", ...props, items: destinationOptions, value: undefined }));
};
exports.ExportDropdown = ExportDropdown;
