import {COMMON_PALETTE_ID} from '../../../../../../../../../shared';
import classic20 from '../../../../../../../../../shared/constants/colors/common/classic-20';
import {EmptyPrepapreArgs} from '../../../__tests__/common.mock';

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

export const linesColoredByFieldWithPostfixArgs = {
    ...EmptyPrepapreArgs,
    ChartEditor: chartEditorMock,
    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,
                    hideLabelMode: 'show',
                    formatting: {
                        format: 'number',
                        showRankDelimiter: true,
                        prefix: '',
                        postfix: '',
                        labelMode: 'absolute',
                        precision: 0,
                    },
                    backgroundSettings: {
                        enabled: false,
                        settingsId: 'b0df4800-88c2-11ee-96b1-05f14cfb8434',
                        settings: {
                            gradientState: {},
                            paletteState: {
                                palette: COMMON_PALETTE_ID.CLASSIC_20,
                                mountedColors: {},
                            },
                            isContinuous: false,
                        },
                        colorFieldGuid: 'e83fb454-ca9a-4083-95be-1994e9957655',
                    },
                },
            ],
            required: true,
            capacity: 1,
            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': 'discrete',
                },
            },
        },
        {
            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',
            },
        },
        {
            allowedTypes: {},
            allowedFinalTypes: {},
            allowedDataTypes: {},
            id: 'y2',
            type: 'y2',
            title: 'section_y2',
            iconProps: {},
            items: [],
            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: [
        {
            virtual: false,
            description: '',
            managed_by: 'user',
            initial_data_type: 'integer',
            data_type: 'integer',
            aggregation_locked: null,
            autoaggregated: false,
            type: 'DIMENSION',
            valid: true,
            aggregation: 'none',
            title: 'Year',
            guid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            has_auto_aggregation: null,
            cast: 'integer',
            hidden: false,
            lock_aggregation: null,
            source: 'Year',
            avatar_id: '7a1555b0-33c8-4643-a8ad-d41d76569b69',
            calc_mode: 'direct',
            formula: '',
            guid_formula: '',
            default_value: null,
            value_constraint: null,
            datasetId: 'y55xt5d3p9csw',
            id: 'dimension-8',
            datasetName: 'Example',
            hideLabelMode: 'show',
            formatting: {
                format: 'number',
                showRankDelimiter: true,
                prefix: '',
                postfix: ' г. в.',
                labelMode: 'absolute',
                precision: 0,
            },
        },
    ],
    colorsConfig: {
        polygonBorders: 'show',
        palette: COMMON_PALETTE_ID.CLASSIC_20,
        mountedColors: {'2014': '6', '2015': '12', '2016': '18', '2017': '19'},
        fieldGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
        coloredByMeasure: false,
        colorMode: 'palette',
        availablePalettes: {[COMMON_PALETTE_ID.CLASSIC_20]: classic20},
        gradientColors: ['#0044A3', '#8CCBFF'],
        loadedColorPalettes: {},
    },
    geopointsConfig: {},
    sort: [],
    visualizationId: 'line',
    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],
        ],
        order: [
            {datasetId: 'y55xt5d3p9csw', title: 'Month', dataType: 'integer'},
            {datasetId: 'y55xt5d3p9csw', title: 'Profit', dataType: 'integer'},
            {datasetId: 'y55xt5d3p9csw', title: 'Year', dataType: 'integer'},
        ],
        totals: [],
    },
    fields: [
        {
            role_spec: {role: 'row', visibility: 'visible'},
            field_type: 'DIMENSION',
            title: 'Month',
            data_type: 'integer',
            item_type: 'field',
            id: 'e83fb454-ca9a-4083-95be-1994e9957655',
            legend_item_id: 0,
            guid: 'e83fb454-ca9a-4083-95be-1994e9957655',
        },
        {
            role_spec: {role: 'measure'},
            field_type: 'MEASURE',
            title: 'Profit',
            data_type: 'integer',
            item_type: 'field',
            id: '4b6463d1-30e1-425e-b7d2-77205bc75de6',
            legend_item_id: 1,
            guid: '4b6463d1-30e1-425e-b7d2-77205bc75de6',
        },
        {
            role_spec: {role: 'row', visibility: 'visible'},
            field_type: 'DIMENSION',
            title: 'Year',
            data_type: 'integer',
            item_type: 'field',
            id: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            legend_item_id: 2,
            guid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
        },
        {
            role_spec: {role: 'filter'},
            field_type: 'DIMENSION',
            title: 'Month',
            data_type: 'integer',
            item_type: 'field',
            id: 'e83fb454-ca9a-4083-95be-1994e9957655',
            legend_item_id: 3,
            guid: 'e83fb454-ca9a-4083-95be-1994e9957655',
        },
    ],
    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: {
        visualization: {
            id: 'line',
        },
    },
    shapes: [
        {
            data_type: 'integer',
            virtual: false,
            valid: true,
            has_auto_aggregation: null,
            initial_data_type: 'integer',
            aggregation_locked: null,
            title: 'Year',
            lock_aggregation: null,
            autoaggregated: false,
            description: '',
            guid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            aggregation: 'none',
            managed_by: 'user',
            cast: 'integer',
            type: 'DIMENSION',
            hidden: false,
            avatar_id: '7a1555b0-33c8-4643-a8ad-d41d76569b69',
            source: 'Year',
            calc_mode: 'direct',
            formula: '',
            guid_formula: '',
            default_value: null,
            value_constraint: null,
            datasetId: 'y55xt5d3p9csw',
            id: 'dimension-8',
            datasetName: 'Example',
            hideLabelMode: 'show',
            formatting: {
                format: 'number',
                showRankDelimiter: true,
                prefix: '',
                postfix: ' г.',
                labelMode: 'absolute',
                precision: 0,
            },
        },
    ],
    shapesConfig: {
        mountedShapes: {'2014': 'Solid', '2015': 'Dot', '2016': 'Dot', '2017': 'Solid'},
        fieldGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
    },
    segments: [],
};

export const linesColoredByFieldWithPostfixResult = {
    graphs: [
        {
            id: '2 014 г. в.',
            title: '2 014 г. в.',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {x: 0, y: 2419, dataLabels: {enabled: false}, label: ''},
                {x: 1, y: 844, dataLabels: {enabled: false}, label: ''},
                {x: 2, y: 429, dataLabels: {enabled: false}, label: ''},
            ],
            dataLabels: {enabled: false, useHTML: false},
            legendTitle: '2 014 г. в.',
            drillDownFilterValue: '2014',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            shapeGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: '2014',
            shapeValue: '2014',
            custom: {},
            color: '#FF91A1',
            dashStyle: 'Solid',
        },
        {
            id: '2 015 г. в.',
            title: '2 015 г. в.',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {x: 0, y: -3308, dataLabels: {enabled: false}, label: ''},
                {x: 1, y: 2789, dataLabels: {enabled: false}, label: ''},
                {x: 2, y: 9667, dataLabels: {enabled: false}, label: ''},
            ],
            dataLabels: {enabled: false, useHTML: false},
            legendTitle: '2 015 г. в.',
            drillDownFilterValue: '2015',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            shapeGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: '2015',
            shapeValue: '2015',
            custom: {},
            color: '#0FA08D',
            dashStyle: 'Dot',
        },
        {
            id: '2 016 г. в.',
            title: '2 016 г. в.',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {x: 0, y: 2785, dataLabels: {enabled: false}, label: ''},
                {x: 1, y: 4969, dataLabels: {enabled: false}, label: ''},
                {x: 2, y: 3535, dataLabels: {enabled: false}, label: ''},
            ],
            dataLabels: {enabled: false, useHTML: false},
            legendTitle: '2 016 г. в.',
            drillDownFilterValue: '2016',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            shapeGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: '2016',
            shapeValue: '2016',
            custom: {},
            color: '#FFB46C',
            dashStyle: 'Dot',
        },
        {
            id: '2 017 г. в.',
            title: '2 017 г. в.',
            tooltip: {chartKitFormatting: true, chartKitPrecision: 0},
            data: [
                {x: 0, y: 7074, dataLabels: {enabled: false}, label: ''},
                {x: 1, y: 1564, dataLabels: {enabled: false}, label: ''},
                {x: 2, y: 14646, dataLabels: {enabled: false}, label: ''},
            ],
            dataLabels: {enabled: false, useHTML: false},
            legendTitle: '2 017 г. в.',
            drillDownFilterValue: '2017',
            colorGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            shapeGuid: 'd0ab8220-16e9-4320-b6da-1ca12163d956',
            connectNulls: false,
            measureFieldTitle: 'Profit',
            yAxis: 0,
            colorValue: '2017',
            shapeValue: '2017',
            custom: {},
            color: '#DCA3D7',
            dashStyle: 'Solid',
        },
    ],
    categories: ['1', '2', '3'],
};
