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

const PisellMenuMeta: IPublicTypeComponentMetadata = {
  componentName: 'PisellMenu',
  title: 'PisellMenu',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.3',
    exportName: 'PisellMenu',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'mode',
      propType: {
        type: 'oneOf',
        value: ['vertical', 'horizontal', 'inline']
      },
      description: '菜单模式',
      defaultValue: 'vertical',
      setter: {
        componentName: 'SelectSetter',
        props: {
          options: [
            { label: '垂直', value: 'vertical' },
            { label: '水平', value: 'horizontal' },
            { label: '内嵌', value: 'inline' },
          ]
        }
      }
    },
    {
      name: 'theme',
      propType: {
        type: 'oneOf',
        value: ['light', 'dark']
      },
      description: '主题',
      defaultValue: 'light',
      setter: {
        componentName: 'RadioGroupSetter',
        props: {
          options: [
            { label: '亮色', value: 'light' },
            { label: '暗色', value: 'dark' },
          ]
        }
      }
    },
    {
      name: 'dataSource',
      propType: 'array',
      description: '菜单项',
      setter: 'JsonSetter'
    },
    {
      name: 'className',
      propType: 'string',
      description: '类名',
      setter: 'StringSetter'
    },
    {
      name: 'style',
      propType: 'object',
      description: '样式',
      setter: 'StyleSetter'
    }
  ],
  configure: {
    component: {
      isContainer: true
    },
    supports: {
      style: true,
      className: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '菜单导航',
    screenshot: 'https://alifd.alicdn.com/fusion-cool/icons/icon-antd/menu-1.jpg',
    schema: {
      componentName: 'PisellMenu',
      props: {
        mode: 'vertical',
        theme: 'light',
        items: [
          {
            label: '菜单项1',
            key: 'item-1'
          },
          {
            label: '菜单项2',
            key: 'item-2'
          }
        ]
      }
    }
  }
];

export default {
  ...PisellMenuMeta,
  snippets
};
