import * as React from 'react';
import FormLayout, { FormRow } from '../../../components/FormLayout';
import { CheckBox } from '../../../components/CheckBox';
import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
import { Tag } from '../../../components/Tag';
import { Box, Flex } from '../../../components/Flex';
import { Tabs } from '../../../components/Tabs';
export const renderFormatColumnRowScopeSummary = (data) => {
    return (React.createElement(Box, { className: "twa:p-2" },
        React.createElement(Box, { className: "twa:mt-3" },
            "Data Rows ",
            React.createElement(Tag, null, data.RowScope?.ExcludeDataRows ? 'no' : 'yes')),
        ' ',
        React.createElement(Box, { className: "twa:mt-3" },
            "Group Rows ",
            React.createElement(Tag, null, data.RowScope?.ExcludeGroupRows ? 'no' : 'yes')),
        React.createElement(Box, { className: "twa:mt-3" },
            "Summary Rows ",
            React.createElement(Tag, null, data.RowScope?.ExcludeSummaryRows ? 'no' : 'yes')),
        React.createElement(Box, { className: "twa:mt-3" },
            "Total Rows ",
            React.createElement(Tag, null, data.RowScope?.ExcludeTotalRows ? 'no' : 'yes'))));
};
export const FormatColumnRowScopeWizardSection = (props) => {
    const { data } = useOnePageAdaptableWizardContext();
    const onExcludeDataRowsChanged = (includeDataRows) => {
        props.onChange({
            ...data,
            RowScope: {
                ...data.RowScope,
                ExcludeDataRows: !includeDataRows,
            },
        });
    };
    const onExcludeGroupedRowsChanged = (includeGroupedRows) => {
        props.onChange({
            ...data,
            RowScope: {
                ...data.RowScope,
                ExcludeGroupRows: !includeGroupedRows,
            },
        });
    };
    const onExcludeSummaryRowsChanged = (includeSummaryRows) => {
        props.onChange({
            ...data,
            RowScope: {
                ...data.RowScope,
                ExcludeSummaryRows: !includeSummaryRows,
            },
        });
    };
    const onExcludeTotalRowsChanged = (includeTotalRows) => {
        props.onChange({
            ...data,
            RowScope: {
                ...data.RowScope,
                ExcludeTotalRows: !includeTotalRows,
            },
        });
    };
    return (React.createElement(Flex, { flexDirection: "column", style: { height: '100%' } },
        React.createElement(Tabs, { className: "twa:mb-3" },
            React.createElement(Tabs.Tab, null, "Row Types"),
            React.createElement(Tabs.Content, null,
                React.createElement(Flex, { flexDirection: "row" },
                    React.createElement(FormLayout, null, data.Target === 'cell' && (React.createElement(React.Fragment, null,
                        React.createElement(FormRow, { label: "Data (leaf) Rows:" },
                            React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
                                React.createElement(CheckBox, { "data-name": "include-data-rows-checkbox", checked: !data.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged, className: "twa:mr-2" }))),
                        React.createElement(FormRow, { label: "Group Rows:" },
                            React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
                                React.createElement(CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: !data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, className: "twa:mr-2" }))),
                        React.createElement(FormRow, { label: "Summary Rows:" },
                            React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
                                React.createElement(CheckBox, { "data-name": "include-summary-rows-checkbox", checked: !data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, className: "twa:mr-2" }))),
                        React.createElement(FormRow, { label: "Total Rows:" },
                            React.createElement(Flex, { alignItems: "center", className: "twa:ml-2" },
                                React.createElement(CheckBox, { "data-name": "include-total-rows-checkbox", checked: !data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, className: "twa:mr-2" })))))))))));
};
