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

const ReviewListMeta: IPublicTypeComponentMetadata = {
  group: '低代码组件',
  componentName: 'ReviewList',
  title: '评价列表',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  category: '信息展示',
  npm: {
    package: '@dckj-npm/dc-material',
    version: '0.1.230',
    exportName: 'ReviewList',
    main: 'src\\index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '数据源绑定',
        name: 'dataList',
        setter: {
          componentName: 'SetterFormVariable',
          props: {
            attributes: [
              {
                label: '评价列表',
                value: 'dataList',
                children: [
                  { label: '头像', value: 'avatar' },
                  { label: '用户名', value: 'userName' },
                  { label: '评分', value: 'score' },
                  { label: '评价时间', value: 'time' },
                  { label: '评价内容', value: 'content' },
                  { label: '点赞数', value: 'likeCount' },
                  { label: '点踩数', value: 'unlikeCount' },
                ],
              },
            ],
          },
        },
      },
    ],
    supports: {
      style: true,
    },
    component: {
      disableBehaviors: ['copy'],
    },
  },
}

const snippets: IPublicTypeSnippet[] = [
  {
    title: '评价列表',
    screenshot: '',
    schema: {
      componentName: 'ReviewList',
      props: {
        dataList: [
          {
            avatar:
              'https://51ymb.com/source/api/upload/1075055372064133120/2025/202501/20250113/1076147300180561920.png',
            userName: 'Mark Jacob',
            time: '2025-03-15',
            score: 4,
            content:
              "It's a really cute skirt! I didn't expect to feel so good in a polyester material. The print is slightly less bright than what is shown in the product description.",
            likeCount: 22,
            unlikeCount: 2,
          },
        ],
      },
      children: [
        {
          componentName: 'NextText',
          props: {
            type: 'h5',
            key: 'userName',
            style: {
              fontSize: '14px',
              color: '#222',
              fontWeght: '500',
            },
          },
        },
        {
          componentName: 'NextText',
          props: {
            type: 'h5',
            key: 'time',
            style: {
              fontSize: '14px',
              color: '#222',
              fontWeght: '500',
            },
          },
        },
        {
          componentName: 'NextText',
          props: {
            type: 'inherit',
            key: 'content',
            style: {
              fontSize: '13px',
              color: '#777',
            },
          },
        },
        {
          componentName: 'Image',
          props: {
            key: 'avatar',
            width: 20,
            height: 20,
            style: {
              borderRadius: '50%',
            },
          },
        },
        {
          componentName: 'Image',
          props: {
            key: 'unlike',
            width: 20,
            height: 20,
            style: {
              borderRadius: '50%',
            },
          },
        },
        {
          componentName: 'Rating',
          props: {
            key: 'rating',
            value: 4,
            size: 'small',
            disabled: true,
          },
        },
      ],
    },
  },
]

export default { ...ReviewListMeta, snippets }
