import snippets from './snippets';
import { MetaType } from '../_utils/type';

const PisellDataSourceContainerMeta: MetaType = {
  snippets,
  componentName: 'PisellDataSourceContainer',
  title: '数据源容器',
  category: '数据展示',
  group: '无代码组件',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.3',
    exportName: 'PisellDataSourceContainer',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  generalProps: [
    {
      type: 'group',
      title: {
        type: 'i18n',
        'en-US': 'Data',
        'zh-CN': '数据',
      },
      display: 'accordion',
      items: [
        {
          name: 'dataSource',
          title: {
            type: 'i18n',
            'en-US': 'Data Source',
            'zh-CN': '数据源',
          },
          setter: {
            componentName: 'PisellDataSourceSetter',
            props: {
              filters: {
                tables: 'all',
                variables: {},
              },
            },
          },
        },
        {
          name: 'currentValue',
          title: {
            type: 'i18n',
            'en-US': 'Current Value',
            'zh-CN': '当前值',
          },
          setter: ['StringSetter', 'VariableSetter'],
        },
      ],
    },
    {
      type: 'group',
      name: 'overrideData',
      title: {
        type: 'i18n',
        'en-US': 'Override Data',
        'zh-CN': '覆盖数据',
      },
      display: 'accordion',
      items: [
        {
          name: 'overrideData.list',
          title: {
            type: 'i18n',
            'en-US': 'List Data',
            'zh-CN': '列表数据',
          },
          setter: 'JsonSetter',
        },
        {
          name: 'overrideData.get',
          title: {
            type: 'i18n',
            'en-US': 'Get Data',
            'zh-CN': '详情数据',
          },
          setter: 'JsonSetter',
        },
      ],
    },
    {
      type: 'group',
      name: '_extraParams',
      title: {
        type: 'i18n',
        'en-US': 'Extra Params',
        'zh-CN': '额外参数',
      },
      display: 'accordion',
      items: [
        {
          name: 'extraParams.list',
          title: {
            type: 'i18n',
            'en-US': 'List Params',
            'zh-CN': '列表参数',
          },
          setter: 'JsonSetter',
        },
        {
          name: 'extraParams.get',
          title: {
            type: 'i18n',
            'en-US': 'Get Params',
            'zh-CN': '获取参数',
          },
          setter: 'JsonSetter',
        },
        {
          name: 'extraParams.update',
          title: {
            type: 'i18n',
            'en-US': 'Update Params',
            'zh-CN': '更新参数',
          },
          setter: 'JsonSetter',
        },
        {
          name: 'extraParams.create',
          title: {
            type: 'i18n',
            'en-US': 'Create Params',
            'zh-CN': '创建参数',
          },
          setter: 'JsonSetter',
        },
        {
          name: 'extraParams.destroy',
          title: {
            type: 'i18n',
            'en-US': 'Destroy Params',
            'zh-CN': '删除参数',
          },
          setter: 'JsonSetter',
        },
      ],
    },
    {
      type: 'group',
      name: 'autoRun',
      title: {
        type: 'i18n',
        'en-US': 'Auto Run',
        'zh-CN': '自动运行',
      },
      display: 'accordion',
      items: [
        {
          name: 'autoRun.list',
          title: {
            type: 'i18n',
            'en-US': 'List Auto Run',
            'zh-CN': '列表自动运行',
          },
          setter: 'BoolSetter',
          defaultValue: true,
        },
        {
          name: 'autoRun.get',
          title: {
            type: 'i18n',
            'en-US': 'Get Auto Run',
            'zh-CN': '详情自动运行',
          },
          setter: 'BoolSetter',
          defaultValue: false,
        },
      ],
    },
    {
      type: 'group',
      name: 'actions',
      title: {
        type: 'i18n',
        'en-US': 'Actions',
        'zh-CN': '操作',
      },
      display: 'accordion',
      items: [
        {
          name: 'actions.list',
          title: {
            type: 'i18n',
            'en-US': 'List Action',
            'zh-CN': '列表操作',
          },
          setter: 'FunctionSetter',
        },
        {
          name: 'actions.get',
          title: {
            type: 'i18n',
            'en-US': 'Get Action',
            'zh-CN': '获取操作',
          },
          setter: 'FunctionSetter',
        },
        {
          name: 'actions.update',
          title: {
            type: 'i18n',
            'en-US': 'Update Action',
            'zh-CN': '更新操作',
          },
          setter: 'FunctionSetter',
        },
        {
          name: 'actions.create',
          title: {
            type: 'i18n',
            'en-US': 'Create Action',
            'zh-CN': '创建操作',
          },
          setter: 'FunctionSetter',
        },
        {
          name: 'actions.destroy',
          title: {
            type: 'i18n',
            'en-US': 'Destroy Action',
            'zh-CN': '删除操作',
          },
          setter: 'FunctionSetter',
        },
      ],
    },
    {
      type: 'group',
      title: {
        type: 'i18n',
        'en-US': 'Pagination',
        'zh-CN': '分页',
      },
      display: 'accordion',
      items: [
        {
          name: 'pagination',
          title: {
            type: 'i18n',
            'en-US': 'Enable Pagination',
            'zh-CN': '启用分页',
          },
          setter: [
            'BoolSetter',
            {
              componentName: 'ObjectSetter',
              props: {
                config: {
                  items: [
                    {
                      name: 'pageNumber',
                      title: {
                        type: 'i18n',
                        'en-US': 'Page Number',
                        'zh-CN': '页码',
                      },
                      setter: 'NumberSetter',
                      defaultValue: 1,
                    },
                    {
                      name: 'pageSize',
                      title: {
                        type: 'i18n',
                        'en-US': 'Page Size',
                        'zh-CN': '每页数量',
                      },
                      setter: 'NumberSetter',
                      defaultValue: 10,
                    },
                  ],
                },
              },
            },
            'VariableSetter',
          ],
          defaultValue: true,
        },
      ],
    },
    {
      type: 'group',
      title: {
        type: 'i18n',
        'en-US': 'Child Components',
        'zh-CN': '子组件配置',
      },
      display: 'accordion',
      items: [
        {
          type: 'group',
          name: '_filterComponent',
          title: {
            type: 'i18n',
            'en-US': 'Filter Component',
            'zh-CN': '筛选组件',
          },
          display: 'entry',
          items: [
            {
              name: 'childComponentProps.filterComponent.value.quickFilter',
              title: {
                type: 'i18n',
                'en-US': 'Quick Filter',
                'zh-CN': '快速筛选',
              },
              setter: 'JsonSetter',
            },
            {
              name: 'childComponentProps.filterComponent.value.otherFilter',
              title: {
                type: 'i18n',
                'en-US': 'Other Filter',
                'zh-CN': '其他筛选',
              },
              setter: 'JsonSetter',
            },
            {
              name: 'childComponentProps.filterComponent.formFiltersPrefix',
              title: {
                type: 'i18n',
                'en-US': 'Form Filters Prefix',
                'zh-CN': '表单筛选前缀',
              },
              setter: 'StringSetter',
            },
            {
              name: 'childComponentProps.filterComponent.quickFilterMaxLength',
              title: {
                type: 'i18n',
                'en-US': 'Quick Filter Max Length',
                'zh-CN': '快速筛选最大数量',
              },
              setter: 'NumberSetter',
            },
          ],
        },
        {
          type: 'group',
          name: '_tabsComponent',
          title: {
            type: 'i18n',
            'en-US': 'Tabs Component',
            'zh-CN': '标签页组件',
          },
          display: 'entry',
          items: [
            {
              name: 'childComponentProps.tabsComponent.items',
              title: {
                type: 'i18n',
                'en-US': 'Tab Items',
                'zh-CN': '标签页项',
              },
              setter: 'JsonSetter',
            },
            {
              name: 'childComponentProps.tabsComponent.type',
              title: {
                type: 'i18n',
                'en-US': 'Type',
                'zh-CN': '类型',
              },
              setter: {
                componentName: 'SelectSetter',
                props: {
                  options: [
                    {
                      title: 'Default',
                      value: 'default',
                    },
                    {
                      title: 'Button',
                      value: 'button',
                    },
                    {
                      title: 'Button Group',
                      value: 'buttonGroup',
                    },
                    {
                      title: 'Dropdown',
                      value: 'dropdown',
                    },
                  ],
                },
              },
            },
          ],
        },
        {
          name: 'childComponentProps.sortComponent',
          title: {
            type: 'i18n',
            'en-US': 'Sort Component',
            'zh-CN': '排序组件',
          },
          setter: 'JsonSetter',
        },
        {
          name: 'childComponentProps.tableComponent',
          title: {
            type: 'i18n',
            'en-US': 'Table Component',
            'zh-CN': '表格组件',
          },
          setter: 'JsonSetter',
        },
        {
          name: 'childComponentProps.paginationComponent',
          title: {
            type: 'i18n',
            'en-US': 'Pagination Component',
            'zh-CN': '分页组件',
          },
          setter: 'JsonSetter',
        },
        {
          type: 'group',
          name: '_columnsSettingComponent',
          title: {
            type: 'i18n',
            'en-US': 'Columns Setting Component',
            'zh-CN': '列设置组件',
          },
          display: 'entry',
          items: [
            {
              name: 'childComponentProps.columnsSettingComponent.value',
              title: {
                type: 'i18n',
                'en-US': 'Value',
                'zh-CN': '值',
              },
              setter: 'JsonSetter',
            },
          ],
        },
      ],
    },
  ],
  configure: {
    props: [
      {
        name: '__designMode',
        title: {
          label: 'Design Mode',
          tip: '__designMode | 设计模式',
        },
        setter: 'StringSetter',
        supportVariable: true,
      },
    ],
    component: {
      isContainer: true,
    },
    supports: {
      style: true,
      className: true,
    },
  },
};

export default PisellDataSourceContainerMeta;
