import { ChartConfig } from 'app/types/ChartConfig';
import { 
  DataViewFieldType, 
  AggregateFieldActionType, 
  ChartDataSectionType,
} from 'app/constants';

const config: ChartConfig = {
  datas: [
    {
        label: 'dimension',
        key: 'dimension',
        required: true,
        type: 'group',
        limit: 3,
        actions: {
            STRING: ['alias', 'colorize', 'sortable'],
        },
    },
    {
      key: 'metrics',
      label: 'metrics',
      type: ChartDataSectionType.Aggregate,
      required: true,
      limit: 1,
      rows: []
    }
  ],
  styles: [
    {
      label: 'sankey.title',
      key: 'sankeyTitle',
      comType: 'group',
      rows: [
        {
          label: 'sankey.nodeWidth',
          key: 'nodeWidth',
          default: 10,
          comType: 'inputNumber',
        },
        {
          label: 'sankey.nodeGap',
          key: 'nodeGap',
          default: 8,
          comType: 'inputNumber',
        },
        {
          label: 'sankey.nodeAlign',
          key: 'nodeAlign',
          default: 'left',
          comType: 'select',
          options: {
            items: [
              { label: '左对齐', value: 'left' },
              { label: '右对齐', value: 'right' },
              { label: '居中', value: 'center' },
              { label: '两端对齐', value: 'justify' },
            ],
          },
        },
      ],
    },
    {
      label: 'sankey.label',
      key: 'label',
      comType: 'group',
      rows: [
        {
          label: 'common.showLabel',
          key: 'showLabel',
          default: true,
          comType: 'checkbox',
        },
        {
          label: 'common.font',
          key: 'font',
          comType: 'font',
        },
      ],
    },
    {
      label: 'sankey.nodeStyle',
      key: 'nodeStyle',
      comType: 'group',
      rows: [
        {
          label: 'sankey.hoverColor',
          key: 'hoverColor',
          default: 'red',
          comType: 'fontColor',
        },
      ],
    },
  ],
  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: {
            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: {
        source: '来源',
        target: '目标',
        metrics: '度量',
        sankey: {
          title: '桑基图设置',
          nodeWidth: '节点宽度',
          nodeGap: '节点间距',
          nodeAlign: '节点对齐',
          label: '标签',
          nodeStyle: '节点样式',
          hoverColor: '悬停颜色'
        },
        common: {
          showLabel: '显示标签',
          font: '字体设置'
        },
        viz: {
          palette: {
            setting: {
              paging: {
                title: '分页设置',
                pageSize: '每页显示条数'
              }
            }
          }
        }
      },
    },
  ],
};

export default config; 