import { PIVOT_AGGREGATION_TOTAL_COL_TYPE, PIVOT_ANY_TOTAL_COL_TYPE, PIVOT_COLUMN_TOTAL_COL_TYPE, PIVOT_GRAND_TOTAL_COL_TYPE, } from '../../layout-manager/src';
export const HIDDEN_COLUMN_TYPE = 'hiddenColumn';
export const hiddenColDefConfig = {
    initialHide: true,
    hide: true,
    lockVisible: true,
    suppressColumnsToolPanel: true,
};
export const CALCULATED_COLUMN_TYPE = 'calculatedColumn';
export const FREE_TEXT_COLUMN_TYPE = 'freeTextColumn';
export const ACTION_COLUMN_TYPE = 'actionColumn';
export const FDC3_COLUMN_TYPE = 'fdc3Column';
export const PIVOT_ANY_TOTAL_COLUMN_TYPE = PIVOT_ANY_TOTAL_COL_TYPE;
export const PIVOT_GRAND_TOTAL_COLUMN_TYPE = PIVOT_GRAND_TOTAL_COL_TYPE;
export const PIVOT_COLUMN_TOTAL_COLUMN_TYPE = PIVOT_COLUMN_TOTAL_COL_TYPE;
export const PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE = PIVOT_AGGREGATION_TOTAL_COL_TYPE;
export function getColumnTypeFriendlyName(columnType) {
    switch (columnType) {
        case CALCULATED_COLUMN_TYPE:
            return 'Calculated Column';
        case FREE_TEXT_COLUMN_TYPE:
            return 'Free Text Column';
        case ACTION_COLUMN_TYPE:
            return 'Action Column';
        case FDC3_COLUMN_TYPE:
            return 'FDC3 Column';
        case PIVOT_ANY_TOTAL_COLUMN_TYPE:
            return 'Pivot Total (any total type)';
        case PIVOT_GRAND_TOTAL_COLUMN_TYPE:
            return 'Pivot Grand Total';
        case PIVOT_COLUMN_TOTAL_COLUMN_TYPE:
            return 'Pivot Column Total';
        case PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE:
            return 'Pivot Aggregation Total';
        default:
            return columnType;
    }
}
// this is only implemented for 1 level groups
export const isValidOrderForColumnGroups = ({ oldColumns, newColumns, }) => {
    const getGroups = (columns) => {
        let prevGroup = '';
        let count = 0;
        columns.forEach((column) => {
            if (column &&
                column.columnGroup &&
                column.columnGroup.groupCount > 1 &&
                !column.columnGroup.allowGroupSplit) {
                if (prevGroup !== column.columnGroup.columnGroupId) {
                    count++;
                }
            }
            prevGroup = column?.columnGroup?.columnGroupId ?? '';
        });
        return count;
    };
    if (getGroups(oldColumns) != getGroups(newColumns)) {
        return false;
    }
    return true;
};
