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

const EventSelectHolderMeta: IPublicTypeComponentMetadata = {
  componentName: 'EventSelectHolder',
  title: '选择持有人',
  category: '数据展示',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/private-materials',
    version: '1.0.4',
    exportName: 'EventSelectHolder',
    main: 'src/index.ts',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '录入方式',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'title',
            title: '标题文案',
            setter: 'StringSetter',
            defaultValue: 'Who would you like to book this event for?',
          },
          {
            name: 'okText',
            title: '按钮文案',
            setter: 'StringSetter',
            defaultValue: 'Confirm',
          },
          {
            name: 'showCancel',
            title: { label: '显示弹窗关闭', tip: 'showCancel | 显示弹窗关闭' },
            setter: 'BoolSetter',
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: [
        {
          name: "onCancel",
          template:
            "onCancel(${extParams}){\n// 点击关闭时的回调\nconsole.log('onCancel');}"
        },
        {
          name: "onOk",
          template:
            "onOk(event, ${extParams}){\n// 点击确认时的回调\nconsole.log('onOk', event);}"
        },
      ],
    },
    component: {
      isContainer: true,
    },
  },
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '选择持有人',
    screenshot: '',
    schema: {
      componentName: 'EventSelectHolder',
      props: {
        title: 'Who would you like to book this event for?',
        okText: 'Confirm',
        showCancel: true,
      },
    },
  },
];

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