export const TEXT_ARRAY_DATA_TYPE = 'textArray';
export const NUMBER_ARRAY_DATA_TYPE = 'numberArray';
export const TUPLE_ARRAY_DATA_TYPE = 'tupleArray';
export const OBJECT_ARRAY_DATA_TYPE = 'objectArray';
export const ALL_ADAPTABLE_DATA_TYPES = [
    'text',
    'number',
    'boolean',
    'date',
    'object',
    TEXT_ARRAY_DATA_TYPE,
    NUMBER_ARRAY_DATA_TYPE,
    TUPLE_ARRAY_DATA_TYPE,
    OBJECT_ARRAY_DATA_TYPE,
    'unknown',
];
// #agGridDataTypeDefinitions
export const agGridDataTypeDefinitions = {
    // AG Grid default types
    number: {
        baseDataType: 'number',
        extendsDataType: 'number',
        // suppress AG Grid editor, we provide our own
        suppressDefaultProperties: true,
    },
    date: {
        baseDataType: 'date',
        extendsDataType: 'date',
        valueParser: null,
        valueFormatter: null,
        suppressDefaultProperties: true,
    },
    // dateString is force-cast to date in AdapTable, see #data_type_dateString
    // text: is kept as is
    // boolean: is kept as is
    // object: is kept as is
    // Adaptable specific types
    [TEXT_ARRAY_DATA_TYPE]: {
        baseDataType: 'text',
        extendsDataType: 'text',
        dataTypeMatcher: (value) => {
            return Array.isArray(value) && value.every((v) => typeof v === 'string');
        },
    },
    [NUMBER_ARRAY_DATA_TYPE]: {
        baseDataType: 'number',
        extendsDataType: 'number',
        dataTypeMatcher: (value) => {
            return Array.isArray(value) && value.every((v) => typeof v === 'number');
        },
    },
    [TUPLE_ARRAY_DATA_TYPE]: {
        baseDataType: 'object',
        extendsDataType: 'object',
        dataTypeMatcher: (value) => {
            return Array.isArray(value) && value.every((v) => Array.isArray(v));
        },
    },
    [OBJECT_ARRAY_DATA_TYPE]: {
        baseDataType: 'object',
        extendsDataType: 'object',
        dataTypeMatcher: (value) => {
            return (Array.isArray(value) &&
                value.every((v) => typeof v === 'object' && !Array.isArray(v) && Object.keys(v).length >= 2));
        },
    },
};
