import {EmptyPrepapreArgs} from '../../../__tests__/common.mock';

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

export const calculatedTitle = {
    ...EmptyPrepapreArgs,
    ChartEditor: chartEditorMock,
    placeholders: [
        {
            id: 'x',
            items: [
                {
                    guid: 'ac8dd226-3372-4212-bde7-17afc792a728',
                    source: 'Category',
                    data_type: 'string',
                    type: 'DIMENSION',
                    title: 'Category',
                },
                {
                    guid: 'e6115038-dc12-41c1-beae-2f7e84d33bc2',
                    source: 'Region',
                    data_type: 'string',
                    type: 'DIMENSION',
                    title: 'Region',
                },
            ],
        },
        {
            id: 'y',
            items: [
                {
                    guid: '809d03e1-15b7-4bdc-b108-653603a27001',
                    source: 'Sales',
                    data_type: 'float',
                    title: 'Sales',
                },
            ],
        },
    ],
    resultData: {
        data: [['Furniture', 'Central', '163798.70024430752']],
        order: [{title: 'Category'}, {title: 'Region'}, {title: 'Sales'}],
    },
    colors: [],
    sort: [],
    colorsConfig: {colors: []},
    shapes: [],
    segments: [],
    labels: [],
    idToTitle: {
        'ac8dd226-3372-4212-bde7-17afc792a728': 'Category',
        'e6115038-dc12-41c1-beae-2f7e84d33bc2': 'Region',
        '809d03e1-15b7-4bdc-b108-653603a27001': 'Sales',
    },
    idToDataType: {
        'ac8dd226-3372-4212-bde7-17afc792a728': 'string',
        'e6115038-dc12-41c1-beae-2f7e84d33bc2': 'string',
        '809d03e1-15b7-4bdc-b108-653603a27001': 'float',
    },
    visualizationId: 'column',
    datasets: [],
    shared: {
        visualization: {id: 'bar'},
    },
};

export const regularTitle = {
    ...EmptyPrepapreArgs,
    ChartEditor: chartEditorMock,
    placeholders: [
        {
            id: 'x',
            items: [
                {
                    guid: 'ac8dd226-3372-4212-bde7-17afc792a728',
                    source: 'Category',
                    data_type: 'string',
                    type: 'DIMENSION',
                    title: 'Category',
                },
            ],
        },
        {
            id: 'y',
            items: [
                {
                    guid: '809d03e1-15b7-4bdc-b108-653603a27001',
                    source: 'Sales',
                    data_type: 'float',
                    title: 'Sales',
                },
            ],
        },
    ],
    resultData: {
        data: [['Furniture', '163798.70024430752']],
        order: [{title: 'Category'}, {title: 'Sales'}],
    },
    colors: [],
    sort: [],
    colorsConfig: {colors: []},
    shapes: [],
    segments: [],
    labels: [],
    idToTitle: {
        'ac8dd226-3372-4212-bde7-17afc792a728': 'Category',
        '809d03e1-15b7-4bdc-b108-653603a27001': 'Sales',
    },
    idToDataType: {
        'ac8dd226-3372-4212-bde7-17afc792a728': 'string',
        '809d03e1-15b7-4bdc-b108-653603a27001': 'float',
    },
    visualizationId: 'column',
    datasets: [],
    shared: {
        visualization: {id: 'bar'},
    },
};

// /wizard/foizv5h101la9-multidatasetnyy-chart-s-odinakovymi-pokazatelyami
export const preparingDataForFieldsWithSameTitlesFromDifferentDatasets = {
    ...EmptyPrepapreArgs,
    ChartEditor: chartEditorMock,
    placeholders: [
        {
            allowedTypes: {},
            allowedDataTypes: {},
            id: 'x',
            type: 'x',
            title: 'section_x',
            icon: {
                key: null,
                ref: null,
                props: {
                    width: '24',
                },
                _owner: null,
                _store: {},
            },
            items: [
                {
                    has_auto_aggregation: false,
                    calc_mode: 'direct',
                    guid: '184e0546-c12d-4991-bb54-0e248126b142',
                    aggregation_locked: null,
                    formula: '',
                    description: '',
                    virtual: false,
                    managed_by: 'user',
                    hidden: false,
                    type: 'DIMENSION',
                    data_type: 'date',
                    avatar_id: '908d43f0-a3fa-11ea-898e-f5e36af92c99',
                    lock_aggregation: null,
                    initial_data_type: 'float',
                    valid: true,
                    title: 'Date',
                    autoaggregated: false,
                    source: '2428083fa6364c40',
                    aggregation: 'none',
                    cast: 'date',
                    datasetId: 'knqi49wfwavoe',
                    id: 'inserted-1615552768302',
                    datasetName: 'dataset-sample',
                },
            ],
            required: true,
            capacity: 1,
            settings: {
                title: 'off',
                titleValue: '',
                type: 'linear',
                grid: 'on',
                gridStep: 'auto',
                gridStepValue: 50,
                hideLabels: 'no',
                labelsView: 'auto',
                nulls: 'ignore',
            },
        },
        {
            allowedTypes: {},
            allowedFinalTypes: {},
            allowedDataTypes: {},
            id: 'y',
            type: 'y',
            title: 'section_y',
            icon: {
                key: null,
                ref: null,
                props: {
                    width: '24',
                },
                _owner: null,
                _store: {},
            },
            items: [
                {
                    has_auto_aggregation: false,
                    calc_mode: 'direct',
                    guid: 'ae208980-4605-47fb-9d13-53bde57fa896',
                    aggregation_locked: null,
                    formula: '',
                    description: '',
                    virtual: false,
                    managed_by: 'user',
                    hidden: false,
                    type: 'MEASURE',
                    data_type: 'integer',
                    avatar_id: '908d43f0-a3fa-11ea-898e-f5e36af92c99',
                    lock_aggregation: null,
                    initial_data_type: 'float',
                    valid: true,
                    title: 'ProfitProto',
                    autoaggregated: false,
                    source: '7ebddadfe6804869',
                    aggregation: 'count',
                    cast: 'float',
                    datasetId: 'knqi49wfwavoe',
                    id: 'inserted-1615552773208',
                    datasetName: 'dataset-sample',
                },
                {
                    aggregation: 'none',
                    aggregation_locked: true,
                    valid: true,
                    description: '',
                    initial_data_type: 'float',
                    has_auto_aggregation: true,
                    data_type: 'integer',
                    managed_by: 'user',
                    cast: 'integer',
                    virtual: false,
                    calc_mode: 'formula',
                    type: 'MEASURE',
                    autoaggregated: true,
                    source: '',
                    lock_aggregation: false,
                    avatar_id: null,
                    title: 'Profit',
                    formula: '[ProfitProto] * 2',
                    hidden: false,
                    guid: 'd4de4490-832f-11eb-ac20-9f8ae368690a',
                    datasetId: 'r0ubmdsbk076l',
                    id: 'inserted-1615552783597',
                    datasetName: 'dataset-sample-copy',
                },
            ],
            capacity: null,
            settings: {
                scale: 'auto',
                scaleValue: 'min-max',
                title: 'off',
                titleValue: '',
                type: 'linear',
                grid: 'on',
                gridStep: 'auto',
                gridStepValue: 50,
                hideLabels: 'no',
                labelsView: 'auto',
            },
        },
        {
            allowedTypes: {},
            allowedFinalTypes: {},
            allowedDataTypes: {},
            id: 'y2',
            type: 'y2',
            title: 'section_y2',
            icon: {
                key: null,
                ref: null,
                props: {
                    width: '24',
                },
                _owner: null,
                _store: {},
            },
            items: [],
            capacity: null,
            settings: {
                scale: 'auto',
                scaleValue: 'min-max',
                title: 'off',
                titleValue: '',
                type: 'linear',
                grid: 'on',
                gridStep: 'auto',
                gridStepValue: 50,
                hideLabels: 'no',
                labelsView: 'auto',
            },
        },
    ],
    resultData: {
        data: [
            ['30', '1970-01-12', '15'],
            ['32', '1970-01-13', '16'],
            ['12', '1970-01-08', '6'],
            ['14', '1970-01-11', '7'],
            ['4', '1970-01-02', '2'],
            ['20', '1970-01-07', '10'],
            ['22', '1970-01-10', '11'],
            ['4', '1970-01-03', '2'],
            ['12', '1970-01-06', '6'],
            ['8', '1970-01-09', '4'],
            ['6', '1970-01-04', '3'],
            ['6', '1970-01-05', '3'],
        ],
        order: [
            {
                datasetId: 'r0ubmdsbk076l',
                title: 'Profit',
            },
            [
                {
                    datasetId: 'r0ubmdsbk076l',
                    title: 'Date',
                },
                {
                    datasetId: 'knqi49wfwavoe',
                    title: 'Date',
                },
            ],
            {
                datasetId: 'knqi49wfwavoe',
                title: 'Profit',
            },
        ],
    },
    colors: [
        {
            title: 'Measure Names',
            type: 'PSEUDO',
            className: 'item pseudo-item dimension-item',
            data_type: 'string',
        },
    ],
    shapes: [],
    segments: [],
    sort: [],
    colorsConfig: {colors: []},
    labels: [],
    idToTitle: {
        'd4de4490-832f-11eb-ac20-9f8ae368690a': 'Profit',
        '21636d40-713d-11eb-a432-2dbdb05aa5a7': '_sales_half',
        '6c0efe50-703d-11eb-bf6c-352aa2d4c7bf': '_url',
        '184e0546-c12d-4991-bb54-0e248126b142': 'Date',
        'ae208980-4605-47fb-9d13-53bde57fa896': 'Profit',
        '53c046b8-a704-427d-b4c7-b69a5baadc2a': 'Sales',
    },
    idToDataType: {
        'd4de4490-832f-11eb-ac20-9f8ae368690a': 'integer',
        '21636d40-713d-11eb-a432-2dbdb05aa5a7': 'float',
        '6c0efe50-703d-11eb-bf6c-352aa2d4c7bf': 'markup',
        '184e0546-c12d-4991-bb54-0e248126b142': 'date',
        'ae208980-4605-47fb-9d13-53bde57fa896': 'integer',
        '53c046b8-a704-427d-b4c7-b69a5baadc2a': 'integer',
    },
    visualizationId: 'line',
    datasets: [
        {
            source_avatars: [],
            component_errors: {
                items: [],
            },
            dataset: {
                source_avatars: [],
                result_schema: [],
                component_errors: {
                    items: [],
                },
                obligatory_filters: [],
                result_schema_aux: {},
                avatar_relations: [],
                created_via: 'user',
                source_features: {},
                preview_enabled: true,
                sources: [],
                rls: {},
            },
            result_schema_aux: {},
            obligatory_filters: [],
            key: 'Users/robot-charts/dataset-sample-copy',
            created_via: 'user',
            preview_enabled: true,
            source_features: {},
            id: 'r0ubmdsbk076l',
            options: {},
            avatar_relations: [],
            sources: [],
            is_favorite: false,
            rls: {},
            realName: 'dataset-sample-copy',
        },
        {
            obligatory_filters: [],
            preview_enabled: true,
            component_errors: {
                items: [],
            },
            result_schema_aux: {},
            avatar_relations: [],
            source_features: {},
            options: {},
            source_avatars: [],
            is_favorite: false,
            sources: [],
            created_via: 'user',
            id: 'knqi49wfwavoe',
            dataset: {
                avatar_relations: [],
                source_features: {},
                source_avatars: [],
                result_schema: [],
                created_via: 'user',
                obligatory_filters: [],
                sources: [],
                preview_enabled: true,
                rls: {},
                component_errors: {
                    items: [],
                },
                result_schema_aux: {},
            },
            key: 'Users/robot-charts/dataset-sample',
            rls: {},
            realName: 'dataset-sample',
        },
    ],
    shared: {
        dataset: {
            source_avatars: [],
            component_errors: {
                items: [],
            },
            dataset: {
                source_avatars: [],
                result_schema: [],
                component_errors: {
                    items: [],
                },
                obligatory_filters: [],
                result_schema_aux: {},
                avatar_relations: [],
                created_via: 'user',
                source_features: {},
                preview_enabled: true,
                sources: [],
                rls: {},
            },
            result_schema_aux: {},
            obligatory_filters: [],
            key: 'Users/robot-charts/dataset-sample-copy',
            created_via: 'user',
            preview_enabled: true,
            source_features: {},
            id: 'r0ubmdsbk076l',
            options: {},
            avatar_relations: [],
            sources: [],
            is_favorite: false,
            rls: {},
            realName: 'dataset-sample-copy',
        },
        extraSettings: {},
        filters: [],
        geopointsConfig: {},
        hierarchies: [],
        links: [
            {
                id: 'f1837d40-832f-11eb-9caf-4dc39edbbf2b',
                fields: {
                    knqi49wfwavoe: {
                        field: {
                            guid: '184e0546-c12d-4991-bb54-0e248126b142',
                            title: 'Date',
                        },
                        dataset: {
                            id: 'knqi49wfwavoe',
                            realName: 'dataset-sample',
                        },
                    },
                    r0ubmdsbk076l: {
                        field: {
                            guid: '184e0546-c12d-4991-bb54-0e248126b142',
                            title: 'Date',
                        },
                        dataset: {
                            id: 'r0ubmdsbk076l',
                            realName: 'dataset-sample-copy',
                        },
                    },
                },
            },
        ],
        shapes: [],
        tooltips: [],
        type: 'datalens',
        updates: [],
        visualization: {
            id: 'line',
            type: 'line',
            name: 'label_visualization-line',
            icon: {
                key: null,
                ref: null,
                props: {
                    width: '24',
                },
                _owner: null,
                _store: {},
            },
            allowFilters: true,
            allowColors: true,
            allowSort: true,
            allowLabels: true,
            colorsCapacity: 2,
            availableLabelModes: ['absolute'],
            allowLayerFilters: false,
        },
        sharedData: {},
    },
};
