import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types'

const CollapseMeta: IPublicTypeComponentMetadata = {
  componentName: 'Collapse',
  group: '低代码组件',
  title: '折叠面板',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  category: '信息展示',
  npm: {
    package: '@dckj-npm/dc-material',
    version: '0.1.331',
    exportName: 'Collapse',
    main: 'src\\index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '数据源绑定',
        name: 'dataList',
        setter: {
          componentName: 'SetterFormVariable',
          props: {
            attributes: [
              {
                label: '折叠面板项',
                value: 'dataList',
                children: [
                  { label: '标题', value: 'title' },
                  { label: '标题内容', value: 'content' },
                ],
              },
            ],
          },
        },
      },
      {
        title: '类型',
        name: 'type',
        setter: {
          componentName: 'RadioGroupSetter',
          props: {
            options: [
              {
                label: '普通',
                value: 'default',
              },
              {
                label: '无边框',
                value: 'borderless',
              },
              {
                label: '有边框',
                value: 'bordered',
              },
            ],
          },
        },
      },
      {
        title: '折叠面板项配置',
        name: 'itemList',
        description: '折叠面板项配置',
        setter: {
          componentName: 'ArraySetter',
          props: {
            itemSetter: {
              componentName: 'ObjectSetter',
              props: {
                config: {
                  items: [
                    {
                      title: {
                        label: {
                          type: 'i18n',
                          'en-US': 'title',
                          'zh-CN': '标题',
                        },
                      },
                      name: 'title',
                      setter: {
                        componentName: 'StringSetter',
                        isRequired: true,
                        initialValue: '',
                      },
                    },
                    {
                      title: {
                        label: {
                          type: 'i18n',
                          'en-US': 'content',
                          'zh-CN': '标题内容',
                        },
                      },
                      name: 'content',
                      setter: {
                        componentName: 'StringSetter',
                        isRequired: true,
                        initialValue: '',
                      },
                    },
                  ],
                },
              },
            },
          },
        },
      },
    ],
    supports: {
      style: true,
      events: [
        {
          name: 'onClick',
        },
      ],
    },
    component: {
      disableBehaviors: ['copy'],
    },
  },
}

const snippets: IPublicTypeSnippet[] = [
  {
    title: '折叠面板',
    screenshot: '',
    schema: {
      componentName: 'Collapse',
    },
  },
]

export default {
  ...CollapseMeta,
  snippets,
}
