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

const SearchProMeta: IPublicTypeComponentMetadata = {
  priority: 14,
  componentName: 'SearchPro',
  title: '高级搜索',
  group: "高级组件",
  category: '筛选条件',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'syber-lowcode-business-materials',
    version: '0.1.0',
    exportName: 'SearchPro',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        name: 'columns',
        title: { label: '配置数据', tip: 'columns | 配置数据' },
        propType: 'object',
        setter: 'JsonSetter',
        supportVariable: true,
      },
      {
        name: 'id',
        title: { label: '缓存id', tip: 'id | 缓存id没有取当前页面默认' },
        propType: 'string',
        setter: 'StringSetter',
        supportVariable: true,
      },
      {
        name: 'defaultParams',
        title: { label: '默认搜索条件', tip: 'defaultParams | 默认搜索条件' },
        propType: 'object',
        setter: 'JsonSetter',
        supportVariable: true,
      },
      {
        name: 'searchFormSettings',
        title: { label: '表单配置', tip: 'searchFormSettings | 定义搜索表单的一些配置' },
        propType: 'object',
        setter: 'JsonSetter',
        supportVariable: true,
      },
      {
        name: 'hiddenSearchInput',
        title: { label: '隐藏搜索框', tip: 'hiddenSearchInput | 是否隐藏搜索框' },
        propType: 'bool',
        setter: 'BoolSetter',
        supportVariable: true,
        defaultValue: false,
      },
      {
        name: 'searchInputPlaceholder',
        title: { label: '搜索框placeholder', tip: 'searchInputPlaceholder | 搜索框placeholder' },
        propType: 'string',
        setter: 'StringSetter',
        supportVariable: true,
      },
      {
        name: 'searchInputDataIndex',
        title: { label: '搜索框dataIndex', tip: 'searchInputDataIndex | 搜索框dataIndex' },
        propType: 'string',
        setter: 'StringSetter',
        supportVariable: true,
      },
    ],
    supports: {
      style: false,
      events: [
        {
          name: 'onSearchSubmit',
          template:
            "onSearchSubmit(event,${extParams}){\n// 搜索回调\nconsole.log('onSearchSubmit', event);}",
        },
      ],
    },
    component: {},
  },
};
const snippets: IPublicTypeSnippet[] = [
  {
    title: '高级搜索',
    screenshot: require('./__screenshots__/robot-item-1.png'),
    schema: {
      componentName: 'SearchPro',
      props: {
        columns: [
          {
            title: '登录状态',
            dataIndex: 'a',
            key: 'a',
            type: 'select',
            options: [
              {
                label: '登录中',
                value: '1',
              },
              {
                label: '成功',
                value: '2',
              },
              {
                label: '封号',
                value: '3',
              },
              {
                label: '验证',
                value: '4',
              },
              {
                label: '失败',
                value: '5',
              },
            ],
            modalProps: { mode: 'multiple' },
          },
          {
            title: '养号状态',
            dataIndex: 'b',
            key: 'b',
            type: 'select',
            options: [
              {
                label: '养号中',
                value: '1',
              },
              {
                label: '已停止',
                value: '2',
              },
            ],
            modalProps: { mode: 'multiple' },
          },
          {
            title: '账号平台',
            dataIndex: 'c',
            key: 'c',
            type: 'select',
            options: [
              {
                label: 'youtube',
                value: 'youtube',
              },
              {
                label: 'twitter',
                value: 'twitter',
              },
              {
                label: 'facebook',
                value: 'facebook',
              },
              {
                label: 'instagram',
                value: 'instagram',
              },
              {
                label: 'tikTok',
                value: 'tikTok',
              },
            ],
            modalProps: { mode: 'multiple' },
          },
          {
            title: '账号',
            dataIndex: 'd',
            key: 'd',
            type: 'input',
            placeholder: '请输入账号或昵称',
          },
          {
            title: '数字人',
            dataIndex: 'h',
            key: 'h',
            type: 'input',
            placeholder: '请输入数字人名称或身份证号',
          },
          {
            title: '设备编号',
            dataIndex: 'e',
            key: 'e',
            type: 'input',
            placeholder: '请输入设备编号',
          },
          {
            title: '设备类型',
            dataIndex: 'f',
            key: 'f',
            type: 'select',
            options: [
              {
                label: 'pc',
                value: 'pc',
              },
              {
                label: '手机',
                value: 'mb',
              },
            ],
            modalProps: { mode: 'multiple' },
          },
          {
            title: '设备状态',
            dataIndex: 'g',
            key: 'g',
            type: 'select',
            options: [
              {
                label: '空闲',
                value: 1,
              },
              {
                label: '忙碌',
                value: 2,
              },
            ],
            modalProps: { mode: 'multiple' },
          },
        ],
        searchFormSettings: { modalWidth: 800, columnSize: 2, labelCol: { span: 6 } },
        hiddenSearchInput: true,
      },
    },
  },
];

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