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

const snippets: IPublicTypeSnippet[] = [
  {
    title: '折叠面板选择器',
    screenshot: '',
    schema: {
      componentName: 'AccordionSelector',
      props: {},
      children: [
        {
          componentName: 'AccordionSelector.Item',
          props: {
            title: '面板项1',
            primaryKey: 'accordion-selector-item-1',
          },
        },
        {
          componentName: 'AccordionSelector.Item',
          props: {
            title: '面板项2',
            primaryKey: 'accordion-selector-item-2',
          },
        },
      ],
    },
  },
]

const AccordionSelectorItemMeta: IPublicTypeComponentMetadata = {
  componentName: 'AccordionSelector.Item',
  title: '折叠面板项', // 修改标题更准确
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@dckj-npm/dc-material', // 修改为与父组件相同的包
    version: '0.1.150',
    exportName: 'AccordionSelector',
    main: 'src\\index.tsx',
    destructuring: true,
    subName: 'Item',
  },
  configure: {
    props: [
      {
        title: '标题',
        name: 'title',
        setter: {
          componentName: 'StringSetter',
          isRequired: false,
          initialValue: '',
        },
      },
      {
        title: '图标',
        name: 'icon',
        setter: {
          componentName: 'IconSetter',
          isRequired: false,
          initialValue: '',
        },
      },
    ],
    supports: {
      events: [
        {
          name: 'onClick',
        },
        {
          name: 'onChange',
        },
      ],
      style: true,
    },
    component: {
      isContainer: true,
      disableBehaviors: '*',
    },
    advanced: {
      hideSelectTools: true,
      callbacks: {
        onMouseDownHook: () => false,
        onClickHook: () => false,
      },
    },
  },
}

const AccordionSelectorMeta: IPublicTypeComponentMetadata[] = [
  {
    group: '低代码组件',
    componentName: 'AccordionSelector',
    title: '折叠面板选择器',
    docUrl: '',
    screenshot: '',
    devMode: 'proCode',
    category: '信息展示',
    npm: {
      package: '@dckj-npm/dc-material',
      version: '0.1.150',
      exportName: 'AccordionSelector',
      main: 'src\\index.tsx',
      destructuring: true,
      subName: '',
    },
    configure: {
      component: {
        isContainer: true,
        nestingRule: {
          childWhitelist: ['AccordionSelector.Item'],
        },
      },
      props,
      supports: {
        style: true,
      },
    },
    snippets,
  },
  AccordionSelectorItemMeta, // 保持这个顺序
]

export default AccordionSelectorMeta
