/**
 * Datart
 *
 * Copyright 2021
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { ChartConfig } from 'app/types/ChartConfig';

const config: ChartConfig = {
  datas: [
    {
      label: 'metrics',
      key: 'metrics',
      required: true,
      allowSameField: false,
      type: 'aggregate',
      limit: [1,3],
    },
    {
      label: 'filter',
      key: 'filter',
      type: 'filter',
      allowSameField: true,
    },
  ],
  styles: [
    {
      label: 'commonChart.title',
      key: 'commonTitle',
      comType: 'group',
      rows: [
        {
          label: 'commonChart.fontSizeOne',
          key: 'fontSizeOne',
          default: 40,
          comType: 'inputNumber',
        },
        {
          label: 'commonChart.fontSizeTwo',
          key: 'fontSizeTwo',
          default: 20,
          comType: 'inputNumber',
        },
        {
          label: 'commonChart.labelSize',
          key: 'labelSize',
          default: 20,
          comType: 'inputNumber',
        },
        {
          label: 'commonChart.dx',
          key: 'dx',
          default: 300,
          comType: 'inputNumber',
        },
        {
          label: 'commonChart.dy',
          key: 'dy',
          default: 40,
          comType: 'inputNumber',
        },
        {
          label: 'commonChart.leftShift',
          key: 'leftShift',
          default: 80,
          comType: 'inputNumber',
        }
      ],
    },
  ],
  settings: [
    {
      label: 'viz.palette.setting.paging.title',
      key: 'paging',
      comType: 'group',
      rows: [
        {
          label: 'viz.palette.setting.paging.pageSize',
          key: 'pageSize',
          default: 100,
          comType: 'inputNumber',
          options: {
            needRefresh: true,
            min: 1,
            max: 1000,
          }
        },
      ],
    },
  ],
  interactions: [
    {
      label: 'drillThrough.title',
      key: 'drillThrough',
      comType: 'checkboxModal',
      default: false,
      options: { modalSize: 'middle' },
      rows: [
        {
          label: 'drillThrough.title',
          key: 'setting',
          comType: 'interaction.drillThrough',
        },
      ],
    },
  ],
  i18ns: [
    {
      lang: 'zh-CN',
      translation: {
        commonChart: {
          title: '布局图设置',
          fontSizeOne: '首行字体大小',
          fontSizeTwo: '次行字体大小',
          nodeGap: '节点间距',
          nodeAlign: '节点对齐',
          label: '标签',
          nodeStyle: '节点样式',
          hoverColor: '悬停颜色',
          labelSize:'维度字体大小',
          dx:'横向间距',
          dy:'纵向间距',
          leftShift:'左偏移'
        },
        section: {
          legend: '图例',
          detail: '详细信息',
        },
        graph:{
          name:{
            commonChart:'布局图'
          }
        },
        common: {
          showLabel: '显示标签',
          rotate: '旋转角度',
          position: '位置',
          font:'标签字体'
        },
        pie: {
          title: '饼图',
          circle: '环状',
          roseType: '南丁格尔玫瑰',
        },
        label: {
          title: '标签',
          showLabel: '显示标签',
          position: '位置',
          positionType: {
            outside: '外侧',
            inside: '内部',
            center: '中心',
          },
          showName: '维度值',
          showPercent: '百分比',
          showValue: '指标值',
          avoidOverlap: '强制显示所有标签',
        },
        legend: {
          title: '图例',
          showLegend: '显示图例',
          type: '图例类型',
          selectAll: '图例全选',
          position: '图例位置',
          height: '图例高度',
        },
        reference: {
          title: '参考线',
          open: '点击参考线配置',
        },
        tooltip: {
          title: '提示信息',
          showPercentage: '增加百分比显示',
        },
      },
    },
    {
      lang: 'en-US',
      translation: {
        section: {
          legend: 'Legend',
          detail: 'Detail',
        },
        common: {
          showLabel: 'Show Label',
          rotate: 'Rotate',
          position: 'Position',
          height: 'Height',
        },
        pie: {
          title: 'Pie',
          circle: 'Circle',
          roseType: 'Rose',
        },
        label: {
          title: 'Label',
          showLabel: 'Show Label',
          position: 'Position',
          positionType: {
            outside: 'Outside',
            inside: 'Inside',
            center: 'Center',
          },
          showName: 'Show Name',
          showPercent: 'Show Percentage',
          showValue: 'Show Value',
          avoidOverlap: 'Force display of all labels',
        },
        legend: {
          title: 'Legend',
          showLegend: 'Show Legend',
          type: 'Type',
          selectAll: 'Select All',
          position: 'Position',
          height: 'Height',
        },
        reference: {
          title: 'Reference',
          open: 'Open',
        },
        tooltip: {
          title: 'Tooltip',
          showPercentage: 'Show Percentage',
        },
      },
    },
  ],
};

export default config;
