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

const PisellNavigationMenuMeta = {
  componentName: 'PisellNavigationMenu',
  title: '导航菜单管理',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.3',
    exportName: 'PisellNavigationMenu',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  props: [
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Value',
          'zh-CN': '菜单数据',
        },
      },
      name: 'value',
      propType: 'array',
      setter: 'JsonSetter',
    },
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Title',
          'zh-CN': '标题',
        },
      },
      name: 'title',
      propType: 'string',
      setter: 'PisellI18nSetter',
    },
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Can Drop',
          'zh-CN': '是否可以拖拽',
        },
      },
      name: 'canDrop',
      propType: 'function',
      setter: 'FunctionSetter',
    },
  ],
  configure: {
    component: {
      isContainer: false,
    },
    supports: {
      style: true,
      className: true,
      events: [
        {
          name: 'onChange',
          template:
            'onChange(value,${extParams}){\n// 数据变化回调\nconsole.log("onChange",value);}',
        },
        {
          name: 'onDelete',
          template:
            'onDelete(value,${extParams}){\n// 删除节点回调\nconsole.log("onDelete",value);}',
        },
        {
          name: 'onAddPage',
          template:
            'onAddPage(value,${extParams}){\n// 添加页面回调\nconsole.log("onAddPage",value);}',
        },
        {
          name: 'onAddSubMenu',
          template:
            'onAddSubMenu(value,${extParams}){\n// 添加子菜单回调\nconsole.log("onAddSubMenu",value);}',
        },
        {
          name: 'onEdit',
          template:
            'onEdit(value,${extParams}){\n// 编辑节点回调\nconsole.log("onEdit",value);}',
        },
      ],
    },
  },
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '导航菜单管理',
    screenshot: '',
    schema: {
      componentName: 'PisellNavigationMenu',
      props: {
        value: [
          {
            id: '1',
            title: '首页',
            children: [],
            icon: 'pisell2-trend-up-01',
            description: '首页描述',
            version: '1.0.0',
          },
          {
            id: '2',
            title: '关于我们',
            icon: 'pisell2-user-circle',
            description: '关于我们描述',
            isGroup: true,
            children: [
              {
                id: '2-1',
                title: '公司介绍',
                icon: 'pisell2-trend-up-01',
                description: '公司介绍描述',
                version: '1.0.0',
                children: [],
              },
            ],
          },
        ],
      },
    },
  },
];

export default {
  ...PisellNavigationMenuMeta,
  snippets,
};
