import {AxisMode, COMMON_PALETTE_ID} from '../../../../../../../../../shared';

const chartEditorMock = {
    getLang: () => {
        return 'en';
    },
    updateHighchartsConfig: () => {},
    updateConfig: () => {},
    getWidgetConfig: () => {},
};

export const barXColoringBaseArgs = {
    placeholders: [
        {
            allowedTypes: {},
            allowedDataTypes: {},
            id: 'x',
            type: 'x',
            title: 'section_x',
            iconProps: {},
            items: [
                {
                    lock_aggregation: null,
                    title: 'Month',
                    hidden: false,
                    guid: 'e83fb454-ca9a-4083-95be-1994e9957655',
                    managed_by: 'user',
                    cast: 'integer',
                    data_type: 'integer',
                    aggregation_locked: null,
                    has_auto_aggregation: null,
                    virtual: false,
                    type: 'DIMENSION',
                    initial_data_type: 'integer',
                    autoaggregated: false,
                    valid: true,
                    aggregation: 'none',
                    description: '',
                    source: 'Month',
                    avatar_id: '7a1555b0-33c8-4643-a8ad-d41d76569b69',
                    calc_mode: 'direct',
                    formula: '',
                    guid_formula: '',
                    datasetId: 'y55xt5d3p9csw',
                    id: 'dimension-7',
                    datasetName: 'Example',
                    default_value: null,
                    value_constraint: null,
                },
            ],
            required: false,
            capacity: 2,
            settings: {
                title: 'off',
                titleValue: '',
                type: 'linear',
                grid: 'on',
                gridStep: 'auto',
                gridStepValue: 50,
                hideLabels: 'no',
                labelsView: 'auto',
                holidays: 'off',
                axisFormatMode: 'auto',
                axisModeMap: {'e83fb454-ca9a-4083-95be-1994e9957655': AxisMode.Continuous},
            },
        },
        {
            allowedTypes: {},
            allowedFinalTypes: {},
            allowedDataTypes: {},
            id: 'y',
            type: 'y',
            title: 'section_y',
            iconProps: {},
            items: [
                {
                    lock_aggregation: false,
                    title: 'Profit',
                    hidden: false,
                    guid: '4b6463d1-30e1-425e-b7d2-77205bc75de6',
                    managed_by: 'user',
                    cast: 'integer',
                    data_type: 'integer',
                    aggregation_locked: false,
                    has_auto_aggregation: false,
                    virtual: false,
                    type: 'MEASURE',
                    initial_data_type: 'float',
                    autoaggregated: false,
                    valid: true,
                    aggregation: 'sum',
                    description: '',
                    source: 'Profit',
                    avatar_id: '7a1555b0-33c8-4643-a8ad-d41d76569b69',
                    calc_mode: 'direct',
                    formula: '',
                    guid_formula: '',
                    datasetId: 'y55xt5d3p9csw',
                    id: 'measure-12',
                    datasetName: 'Example',
                    default_value: null,
                    value_constraint: null,
                },
            ],
            settings: {
                scale: 'auto',
                scaleValue: 'min-max',
                title: 'off',
                titleValue: '',
                type: 'linear',
                grid: 'on',
                gridStep: 'auto',
                gridStepValue: 50,
                hideLabels: 'no',
                labelsView: 'auto',
                nulls: 'ignore',
                axisFormatMode: 'auto',
            },
        },
    ],
    colors: [
        {
            lock_aggregation: null,
            title: 'Year',
            hidden: false,
            guid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            managed_by: 'user',
            cast: 'integer',
            data_type: 'integer',
            aggregation_locked: null,
            has_auto_aggregation: null,
            virtual: false,
            type: 'DIMENSION',
            initial_data_type: 'integer',
            autoaggregated: false,
            valid: true,
            aggregation: 'none',
            description: '',
            source: 'Year',
            avatar_id: '7a1555b0-33c8-4643-a8ad-d41d76569b69',
            calc_mode: 'direct',
            formula: '',
            guid_formula: '',
            datasetId: 'y55xt5d3p9csw',
            id: 'dimension-8',
            datasetName: 'Example',
            default_value: null,
            value_constraint: null,
        },
    ],
    colorsConfig: {},
    geopointsConfig: {},
    sort: [],
    visualizationId: 'column',
    labels: [],
    tooltips: [],
    datasets: ['y55xt5d3p9csw'],
    resultData: {
        data: [
            ['2', '2789', '2015'],
            ['1', '7074', '2017'],
            ['3', '9667', '2015'],
            ['2', '844', '2014'],
            ['1', '2785', '2016'],
            ['3', '429', '2014'],
            ['3', '14646', '2017'],
            ['2', '1564', '2017'],
            ['1', '-3308', '2015'],
            ['3', '3535', '2016'],
            ['2', '4969', '2016'],
            ['1', '2419', '2014'],
        ],
        legend: [
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
            [0, 1, 2],
        ],
        order: [
            {datasetId: 'y55xt5d3p9csw', title: 'Month', dataType: 'integer'},
            {datasetId: 'y55xt5d3p9csw', title: 'Profit', dataType: 'integer'},
            {datasetId: 'y55xt5d3p9csw', title: 'Year', dataType: 'integer'},
        ],
        totals: [],
    },
    fields: [
        {
            title: 'Month',
            role_spec: {role: 'row', visibility: 'visible'},
            data_type: 'integer',
            id: 'e83fb454-ca9a-4083-95be-1994e9957655',
            field_type: 'DIMENSION',
            item_type: 'field',
            legend_item_id: 0,
            guid: 'e83fb454-ca9a-4083-95be-1994e9957655',
        },
        {
            title: 'Profit',
            role_spec: {role: 'measure'},
            data_type: 'integer',
            id: '4b6463d1-30e1-425e-b7d2-77205bc75de6',
            field_type: 'MEASURE',
            item_type: 'field',
            legend_item_id: 1,
            guid: '4b6463d1-30e1-425e-b7d2-77205bc75de6',
        },
        {
            title: 'Year',
            role_spec: {role: 'row', visibility: 'visible'},
            data_type: 'integer',
            id: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            field_type: 'DIMENSION',
            item_type: 'field',
            legend_item_id: 2,
            guid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
        },
    ],
    idToTitle: {
        'e83fb454-ca9a-4083-95be-1994e9957655': 'Month',
        '4b6463d1-30e1-425e-b7d2-77205bc75de6': 'Profit',
        'd0ab8220-16e9-4320-b6da-1ca12163d956': 'Year',
    },
    idToDataType: {
        'e83fb454-ca9a-4083-95be-1994e9957655': 'integer',
        '4b6463d1-30e1-425e-b7d2-77205bc75de6': 'integer',
        'd0ab8220-16e9-4320-b6da-1ca12163d956': 'integer',
    },
    shared: {
        sharedData: {},
    },
    ChartEditor: chartEditorMock,
    shapes: [],
    segments: [],
};

export const barXColoringDimensionByGradientArgs = {
    colorsConfig: {
        gradientMode: '2-point',
        gradientPalette: 'red-blue',
        polygonBorders: 'show',
        reversed: false,
        thresholdsMode: 'auto',
        colorMode: 'gradient',
        colors: [
            '#4DA2F1',
            '#FF3D64',
            '#8AD554',
            '#FFC636',
            '#FFB9DD',
            '#84D1EE',
            '#FF91A1',
            '#54A520',
            '#DB9100',
            '#BA74B3',
            '#1F68A9',
            '#ED65A9',
            '#0FA08D',
            '#FF7E00',
            '#E8B0A4',
            '#52A6C5',
            '#BE2443',
            '#70C1AF',
            '#FFB46C',
            '#DCA3D7',
        ],
        gradientColors: ['#BA2534', '#1B6DD1'],
        loadedColorPalettes: {},
    },
};

export const barXColoringDimensionByPaletteArgs = {
    colorsConfig: {
        colorMode: 'palette',
        coloredByMeasure: false,
        colors: [
            '#4DA2F1',
            '#FF3D64',
            '#8AD554',
            '#FFC636',
            '#FFB9DD',
            '#84D1EE',
            '#FF91A1',
            '#54A520',
            '#DB9100',
            '#BA74B3',
            '#1F68A9',
            '#ED65A9',
            '#0FA08D',
            '#FF7E00',
            '#E8B0A4',
            '#52A6C5',
            '#BE2443',
            '#70C1AF',
            '#FFB46C',
            '#DCA3D7',
        ],
        fieldGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
        gradientColors: ['#0044A3', '#8CCBFF'],
        loadedColorPalettes: {},
        mountedColors: {
            '2014': '12',
            '2015': '13',
            '2016': '14',
            '2017': '15',
        },
        palette: COMMON_PALETTE_ID.CLASSIC_20,
        polygonBorders: 'show',
    },
};

export const barXColoringDimensionByGradientResult = {
    graphs: [
        {
            id: '2014',
            title: '2014',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {
                    y: 2419,
                    colorValue: 2014,
                    dataLabels: {enabled: false},
                    x: 1,
                    label: '',
                    color: 'rgb(186, 37, 52)',
                },
                {
                    y: 844,
                    colorValue: 2014,
                    dataLabels: {enabled: false},
                    x: 2,
                    label: '',
                    color: 'rgb(186, 37, 52)',
                },
                {
                    y: 429,
                    colorValue: 2014,
                    dataLabels: {enabled: false},
                    x: 3,
                    label: '',
                    color: 'rgb(186, 37, 52)',
                },
            ],
            legendTitle: '2014',
            drillDownFilterValue: '2014',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: 2014,
            shapeValue: 'Profit',
            custom: {},
        },
        {
            id: '2015',
            title: '2015',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {
                    y: -3308,
                    colorValue: 2015,
                    dataLabels: {enabled: false},
                    x: 1,
                    label: '',
                    color: 'rgb(133, 61, 104)',
                },
                {
                    y: 2789,
                    colorValue: 2015,
                    dataLabels: {enabled: false},
                    x: 2,
                    label: '',
                    color: 'rgb(133, 61, 104)',
                },
                {
                    y: 9667,
                    colorValue: 2015,
                    dataLabels: {enabled: false},
                    x: 3,
                    label: '',
                    color: 'rgb(133, 61, 104)',
                },
            ],
            legendTitle: '2015',
            drillDownFilterValue: '2015',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: 2015,
            shapeValue: 'Profit',
            custom: {},
        },
        {
            id: '2016',
            title: '2016',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {
                    y: 2785,
                    colorValue: 2016,
                    dataLabels: {enabled: false},
                    x: 1,
                    label: '',
                    color: 'rgb(80, 85, 156)',
                },
                {
                    y: 4969,
                    colorValue: 2016,
                    dataLabels: {enabled: false},
                    x: 2,
                    label: '',
                    color: 'rgb(80, 85, 156)',
                },
                {
                    y: 3535,
                    colorValue: 2016,
                    dataLabels: {enabled: false},
                    x: 3,
                    label: '',
                    color: 'rgb(80, 85, 156)',
                },
            ],
            legendTitle: '2016',
            drillDownFilterValue: '2016',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: 2016,
            shapeValue: 'Profit',
            custom: {},
        },
        {
            id: '2017',
            title: '2017',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {
                    y: 7074,
                    colorValue: 2017,
                    dataLabels: {enabled: false},
                    x: 1,
                    label: '',
                    color: 'rgb(27, 109, 209)',
                },
                {
                    y: 1564,
                    colorValue: 2017,
                    dataLabels: {enabled: false},
                    x: 2,
                    label: '',
                    color: 'rgb(27, 109, 209)',
                },
                {
                    y: 14646,
                    colorValue: 2017,
                    dataLabels: {enabled: false},
                    x: 3,
                    label: '',
                    color: 'rgb(27, 109, 209)',
                },
            ],
            legendTitle: '2017',
            drillDownFilterValue: '2017',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: 2017,
            shapeValue: 'Profit',
            custom: {},
        },
    ],
};

export const barXColoringDimensionByPaletteResult = {
    graphs: [
        {
            id: '2014',
            title: '2014',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {y: 2419, dataLabels: {enabled: false}, x: 1, label: ''},
                {y: 844, dataLabels: {enabled: false}, x: 2, label: ''},
                {y: 429, dataLabels: {enabled: false}, x: 3, label: ''},
            ],
            legendTitle: '2014',
            drillDownFilterValue: '2014',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: '2014',
            shapeValue: 'Profit',
            custom: {},
            color: '#0FA08D',
        },
        {
            id: '2015',
            title: '2015',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {y: -3308, dataLabels: {enabled: false}, x: 1, label: ''},
                {y: 2789, dataLabels: {enabled: false}, x: 2, label: ''},
                {y: 9667, dataLabels: {enabled: false}, x: 3, label: ''},
            ],
            legendTitle: '2015',
            drillDownFilterValue: '2015',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: '2015',
            shapeValue: 'Profit',
            custom: {},
            color: '#FF7E00',
        },
        {
            id: '2016',
            title: '2016',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {y: 2785, dataLabels: {enabled: false}, x: 1, label: ''},
                {y: 4969, dataLabels: {enabled: false}, x: 2, label: ''},
                {y: 3535, dataLabels: {enabled: false}, x: 3, label: ''},
            ],
            legendTitle: '2016',
            drillDownFilterValue: '2016',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: '2016',
            shapeValue: 'Profit',
            custom: {},
            color: '#E8B0A4',
        },
        {
            id: '2017',
            title: '2017',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {y: 7074, dataLabels: {enabled: false}, x: 1, label: ''},
                {y: 1564, dataLabels: {enabled: false}, x: 2, label: ''},
                {y: 14646, dataLabels: {enabled: false}, x: 3, label: ''},
            ],
            legendTitle: '2017',
            drillDownFilterValue: '2017',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: '2017',
            shapeValue: 'Profit',
            custom: {},
            color: '#52A6C5',
        },
    ],
};

export const barXPrepareForQLArgs = {
    placeholders: [
        {
            allowedTypes: {},
            allowedDataTypes: {},
            id: 'x',
            type: 'x',
            title: 'section_x',
            iconProps: {},
            items: [
                {
                    guid: 'built_year-0',
                    title: 'built_year',
                    datasetId: 'ql-mocked-dataset',
                    data_type: 'string',
                    cast: 'string',
                    type: 'DIMENSION',
                    calc_mode: 'direct',
                    inspectHidden: true,
                    formulaHidden: true,
                    noEdit: true,
                },
            ],
            required: false,
            capacity: 2,
            settings: {
                title: 'off',
                titleValue: '',
                type: 'linear',
                grid: 'on',
                gridStep: 'auto',
                gridStepValue: 50,
                hideLabels: 'no',
                labelsView: 'auto',
                holidays: 'off',
                axisFormatMode: 'auto',
                axisModeMap: {'built_year-0': AxisMode.Discrete},
                disableAxisMode: false,
            },
        },
        {
            allowedTypes: {},
            allowedFinalTypes: {},
            allowedDataTypes: {},
            id: 'y',
            type: 'y',
            title: 'section_y',
            iconProps: {},
            items: [
                {
                    guid: 'iznos-1',
                    title: 'iznos',
                    datasetId: 'ql-mocked-dataset',
                    data_type: 'float',
                    cast: 'float',
                    type: 'DIMENSION',
                    calc_mode: 'direct',
                    inspectHidden: true,
                    formulaHidden: true,
                    noEdit: true,
                },
            ],
            settings: {
                scale: 'auto',
                scaleValue: 'min-max',
                title: 'off',
                titleValue: '',
                type: 'linear',
                grid: 'on',
                gridStep: 'auto',
                gridStepValue: 50,
                hideLabels: 'no',
                labelsView: 'auto',
                nulls: 'connect',
                axisFormatMode: 'auto',
            },
        },
    ],
    fields: [],
    colors: [],
    colorsConfig: {
        colors: [
            '#4DA2F1',
            '#FF3D64',
            '#8AD554',
            '#FFC636',
            '#FFB9DD',
            '#84D1EE',
            '#FF91A1',
            '#54A520',
            '#DB9100',
            '#BA74B3',
            '#1F68A9',
            '#ED65A9',
            '#0FA08D',
            '#FF7E00',
            '#E8B0A4',
            '#52A6C5',
            '#BE2443',
            '#70C1AF',
            '#FFB46C',
            '#DCA3D7',
        ],
        gradientColors: ['#0044A3', '#8CCBFF'],
        loadedColorPalettes: {},
    },
    sort: [],
    visualizationId: 'column',
    labels: [],
    tooltips: [],
    datasets: [],
    resultData: {
        data: [
            ['1976', 100],
            ['1970', 70],
            ['1950', 78],
            ['1949', 67],
            ['1958', 72],
        ],
        order: [
            {datasetId: 'ql-mocked-dataset', title: 'built_year'},
            {datasetId: 'ql-mocked-dataset', title: 'iznos'},
            {datasetId: 'ql-mocked-dataset', title: 'Column Names'},
        ],
        totals: [],
    },
    idToTitle: {'built_year-0': 'built_year', 'iznos-1': 'iznos', '': 'Column Names'},
    idToDataType: {'built_year-0': 'string', 'iznos-1': 'float', '': 'string'},
    shared: {
        sharedData: {},
    },
    ChartEditor: chartEditorMock,
    shapes: [],
    shapesConfig: {},
    segments: [],
    disableDefaultSorting: false,
};

export const barXPrepareForQLResult = {
    graphs: [
        {
            id: 'iznos',
            title: 'iznos',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 2},
            data: [
                {x: 0, y: 67, dataLabels: {enabled: false}, label: ''},
                {x: 1, y: 78, dataLabels: {enabled: false}, label: ''},
                {x: 2, y: 72, dataLabels: {enabled: false}, label: ''},
                {x: 3, y: 70, dataLabels: {enabled: false}, label: ''},
                {x: 4, y: 100, dataLabels: {enabled: false}, label: ''},
            ],
            legendTitle: 'iznos',
            colorKey: 'iznos',
            colorGuid: null,
            shapeGuid: null,
            connectNulls: true,
            measureFieldTitle: 'iznos',
            yAxis: 0,
            custom: {},
            color: '#4DA2F1',
        },
    ],
    categories: ['1949', '1950', '1958', '1970', '1976'],
};
