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

const CustomRadioGroupMeta: IPublicTypeComponentMetadata = {
  group: '低代码组件',
  componentName: 'CustomRadioGroup',
  title: '单选组',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  category: '信息输入',
  npm: {
    package: '@dckj-npm/dc-material',
    version: '0.1.27',
    exportName: 'CustomRadioGroup',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        name: '数据源绑定',
        setter: {
          componentName: 'SetterFormVariable',
          props: {
            attributes: [
              {
                label: '选项',
                value: 'options',
                children: [
                  { label: '值', isRequire: true, value: 'value' },
                  { label: '名称', isRequire: true, value: 'label' },
                ],
              },
            ],
          },
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'options',
            'zh-CN': '选项',
          },
          tip: 'options | 选项',
        },
        name: 'options',
        description: '选项',
        setter: {
          componentName: 'ArraySetter',
          props: {
            itemSetter: {
              componentName: 'ObjectSetter',
              props: {
                config: {
                  items: [
                    {
                      title: {
                        label: {
                          type: 'i18n',
                          'en-US': 'label',
                          'zh-CN': 'label',
                        },
                      },
                      name: 'label',
                      setter: {
                        componentName: 'StringSetter',
                        isRequired: true,
                        initialValue: '',
                      },
                    },
                    {
                      title: {
                        label: {
                          type: 'i18n',
                          'en-US': 'value',
                          'zh-CN': 'value',
                        },
                      },
                      name: 'value',
                      setter: {
                        componentName: 'StringSetter',
                        isRequired: true,
                        initialValue: '',
                      },
                    },
                  ],
                  extraSetter: {
                    componentName: 'MixedSetter',
                    isRequired: false,
                    props: {},
                  },
                },
              },
            },
          },
          isRequired: true,
          initialValue: [
            { label: '标签', value: '1' },
            { label: '标签', value: '2' },
            { label: '标签', value: '3' },
            { label: '标签', value: '4' },
            { label: '标签', value: '5' },
          ],
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'defaultValue',
            'zh-CN': '默认值',
          },
          tip: 'defaultValue | 默认值',
        },
        name: 'defaultValue',
        description: '默认值',
        setter: {
          componentName: 'StringSetter',
          isRequired: false,
          initialValue: '',
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'isWrap',
            'zh-CN': '是否换行',
          },
          tip: 'isWrap | 是否换行',
        },
        name: 'isWrap',
        description: '是否换行',
        setter: {
          componentName: 'BoolSetter',
          isRequired: false,
          initialValue: true,
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'selectColor',
            'zh-CN': '选中颜色',
          },
          tip: 'selectColor | 选中颜色',
        },
        name: 'selectColor',
        description: '选中颜色',
        setter: {
          componentName: 'ColorSetter',
          isRequired: false,
          initialValue: '#F5743F',
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'selectTextColor',
            'zh-CN': '选中的文字颜色',
          },
          tip: 'selectTextColor | 选中的文字颜色',
        },
        name: 'selectTextColor',
        description: '选中的文字颜色',
        setter: {
          componentName: 'ColorSetter',
          isRequired: false,
          initialValue: '#FFFFFF',
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'unSelectColor',
            'zh-CN': '未选中颜色',
          },
          tip: 'unSelectColor | 未选中颜色',
        },
        name: 'unSelectColor',
        description: '未选中颜色',
        setter: {
          componentName: 'ColorSetter',
          isRequired: false,
          initialValue: '#F0F0F0',
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'unSelectTextColor',
            'zh-CN': '未选中的文字颜色',
          },
          tip: 'unSelectTextColor | 未选中的文字颜色',
        },
        name: 'unSelectTextColor',
        description: '未选中的文字颜色',
        setter: {
          componentName: 'ColorSetter',
          isRequired: false,
          initialValue: '#666666',
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'onChange',
            'zh-CN': '改变事件',
          },
          tip: 'onChange | 改变事件',
        },
        name: 'onChange',
        description: '改变事件',
        setter: {
          componentName: 'FunctionSetter',
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'type',
            'zh-CN': '类型',
          },
          tip: 'type | 类型',
        },
        name: 'type',
        description: '类型',
        setter: {
          componentName: 'RadioGroupSetter',
          props: {
            dataSource: [
              {
                label: 'text',
                value: 'text',
              },
              {
                label: 'button',
                value: 'button',
              },
            ],
            options: [
              {
                label: 'text',
                value: 'text',
              },
              {
                label: 'button',
                value: 'button',
              },
            ],
          },
          initialValue: 'button',
        },
      },
      {
        title: {
          label: {
            type: 'i18n',
            'en-US': 'name',
            'zh-CN': '名称',
          },
          tip: 'name | 名称',
        },
        name: 'name',
        description: '名称',
        setter: {
          componentName: 'StringSetter',
          isRequired: false,
          initialValue: '',
        },
      },
    ],
    supports: {
      style: true,
    },
    component: {
      disableBehaviors: ['copy'],
    },
  },
}
const snippets: IPublicTypeSnippet[] = [
  {
    title: '单选组',
    screenshot: '',
    schema: {
      componentName: 'CustomRadioGroup',
      props: {},
      children: [
        {
          componentName: 'CustomRadioGroupItem',
          props: {
            name: '报名火热',
            color: 'orange',
            key: 'custom-radio-group-item',
          },
        },
      ],
    },
  },
]

export default {
  ...CustomRadioGroupMeta,
  snippets,
}
