"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReportColumnTypeWizard = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const WizardPanel_1 = tslib_1.__importDefault(require("../../../components/WizardPanel"));
const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
const rebass_1 = require("rebass");
const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
class ReportColumnTypeWizard extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            ReportColumnScope: this.props.data.ReportColumnScope,
        };
    }
    render() {
        return (React.createElement("div", { "data-name": 'report-select-columns' },
            React.createElement(WizardPanel_1.default, null,
                React.createElement(rebass_1.Flex, { flexDirection: "column", padding: 2 },
                    React.createElement(HelpBlock_1.default, { marginBottom: 1 }, "All columns in the datasource will be included in the Report, whether visible or not at time of export"),
                    React.createElement(Radio_1.default, { value: "All", checked: this.state.ReportColumnScope == 'AllColumns', onChange: (_, e) => this.onScopeSelectChanged(e), marginRight: 3 }, "All Columns"),
                    ' ',
                    React.createElement(HelpBlock_1.default, { marginBottom: 1 }, "Only columns that are visible at the time the Report is exported will be included"),
                    React.createElement(Radio_1.default, { value: "Visible", checked: this.state.ReportColumnScope == 'VisibleColumns', onChange: (_, e) => this.onScopeSelectChanged(e), marginRight: 3 }, "Visible Columns Only"),
                    ' ',
                    React.createElement(HelpBlock_1.default, { marginBottom: 1 }, "Only selected columns (which you will choose in the next step) will be exported - whether visible or not"),
                    React.createElement(Radio_1.default, { value: "Bespoke", marginRight: 3, checked: this.state.ReportColumnScope == 'ScopeColumns', onChange: (_, e) => this.onScopeSelectChanged(e) }, "Bespoke Columns"),
                    ' '))));
    }
    onScopeSelectChanged(event) {
        let e = event.target;
        if (e.value == 'All') {
            this.setState({
                ReportColumnScope: 'AllColumns',
                SelectedColumnValues: [],
            }, () => this.props.updateGoBackState());
        }
        else if (e.value == 'Visible') {
            this.setState({
                ReportColumnScope: 'VisibleColumns',
                SelectedColumnValues: [],
            }, () => this.props.updateGoBackState());
        }
        else {
            this.setState({
                ReportColumnScope: 'ScopeColumns',
            }, () => this.props.updateGoBackState());
        }
    }
    canNext() {
        return (this.state.ReportColumnScope == 'AllColumns' ||
            this.state.ReportColumnScope == 'VisibleColumns' ||
            this.state.ReportColumnScope == 'ScopeColumns');
    }
    canBack() {
        return true;
    }
    next() {
        this.props.data.ReportColumnScope = this.state.ReportColumnScope;
        if (this.state.ReportColumnScope != 'ScopeColumns') {
            this.props.data.Scope = undefined;
        }
    }
    back() { }
    getIndexStepIncrement() {
        return this.state.ReportColumnScope == 'ScopeColumns' ? 1 : 2;
    }
    getIndexStepDecrement() {
        return 1;
    }
}
exports.ReportColumnTypeWizard = ReportColumnTypeWizard;
