const Meta = {
  componentName: 'ClientSearch',
  title: '客户搜索',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/private-materials',
    version: '1.0.0',
    exportName: 'ClientSearch',
    main: 'src/index.ts',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: { label: '容器配置' },
        type: 'group',
        display: 'block',
        items: [
          {
            title: { label: '打开状态', tip: 'containerProps.open | 打开状态' },
            name: 'containerProps.open',
            setter: 'BoolSetter',
            defaultValue: true,
          },
          {
            title: { label: '关闭回调', tip: 'containerProps.onCancel | 关闭回调' },
            name: 'containerProps.onCancel',
            setter: 'FunctionSetter',
          },
          {
            title: {
              label: '关闭销毁',
              tip: 'containerProps.destroyOnClose | 关闭销毁',
            },
            name: 'containerProps.destroyOnClose',
            setter: 'BoolSetter',
            defaultValue: true,
          },
          {
            title: { label: '宽度', tip: 'containerProps.width | 宽度' },
            name: 'containerProps.width',
            setter: 'NumberSetter',
            defaultValue: 680,
          },
        ],
      },
      {
        title: { label: '数据与状态' },
        type: 'group',
        display: 'block',
        items: [
          {
            title: { label: '数据源', tip: 'dataSource | 数据源' },
            name: 'dataSource',
            setter: ['JsonSetter'],
          },
          {
            title: { label: '搜索关键字', tip: 'keyword | 搜索关键字' },
            name: 'keyword',
            setter: ['StringSetter'],
          },
          {
            title: { label: '加载中', tip: 'loading | 加载状态' },
            name: 'loading',
            setter: 'BoolSetter',
          },
          {
            title: { label: '外部状态', tip: 'state | 外部状态' },
            name: 'state',
            setter: ['JsonSetter'],
          },
        ],
      },
      {
        title: { label: '新建按钮' },
        type: 'group',
        display: 'block',
        items: [
          {
            title: {
              label: '显示新建按钮',
              tip: 'isShowNewButton | 显示新建按钮',
            },
            name: 'isShowNewButton',
            setter: 'BoolSetter',
          },
          {
            title: { label: '按钮对齐', tip: 'newButtonAlign | 按钮对齐' },
            name: 'newButtonAlign',
            setter: {
              componentName: 'SelectSetter',
              props: {
                options: [
                  { title: '左对齐', value: 'left' },
                  { title: '居中', value: 'center' },
                  { title: '右对齐', value: 'right' },
                ],
              },
            },
          },
          {
            title: { label: '按钮文案', tip: 'newButtonText | 按钮文案' },
            name: 'newButtonText',
            setter: ['StringSetter'],
          },
          {
            title: {
              label: '新建弹窗数据',
              tip: 'newDialogDataSource | 新建弹窗数据',
            },
            name: 'newDialogDataSource',
            setter: ['JsonSetter'],
          },
        ],
      },
      {
        title: { label: '搜索配置' },
        type: 'group',
        display: 'block',
        items: [
          {
            title: { label: '显示搜索框', tip: 'isShowSearch | 显示搜索框' },
            name: 'isShowSearch',
            setter: 'BoolSetter',
          },
          {
            title: {
              label: '显示搜索相机',
              tip: 'isShowSearchCamera | 显示搜索相机',
            },
            name: 'isShowSearchCamera',
            setter: 'BoolSetter',
          },
          {
            title: { label: '搜索图标', tip: 'searchIcon | 搜索图标' },
            name: 'searchIcon',
            setter: ['StringSetter'],
          },
          {
            title: { label: '搜索占位', tip: 'placeholder | 搜索占位' },
            name: 'placeholder',
            setter: ['StringSetter'],
          },
          {
            title: {
              label: '显示搜索按钮',
              tip: 'isShowSearchButton | 显示搜索按钮',
            },
            name: 'isShowSearchButton',
            setter: 'BoolSetter',
          },
        ],
      },
      {
        title: { label: '结果配置' },
        type: 'group',
        display: 'block',
        items: [
          {
            title: { label: '排序方式', tip: 'resultSort | 排序方式' },
            name: 'resultSort',
            setter: {
              componentName: 'RadioGroupSetter',
              props: {
                options: [
                  { title: '升序', value: 'asc' },
                  { title: '降序', value: 'desc' },
                  { title: '自定义', value: 'custom' },
                ],
              },
            },
          },
          {
            title: { label: '排序字段', tip: 'sortBy | 排序字段' },
            name: 'sortBy',
            setter: ['StringSetter'],
          },
          {
            title: { label: '列表配置', tip: 'resultProps | 列表配置' },
            name: 'resultProps',
            setter: ['JsonSetter'],
          },
        ],
      },
      {
        title: { label: '扩展能力' },
        type: 'group',
        display: 'block',
        items: [
          {
            title: { label: '显示扫码枪', tip: 'isShowScanner | 显示扫码枪' },
            name: 'isShowScanner',
            setter: 'BoolSetter',
          },
          {
            title: { label: '显示摄像头', tip: 'isShowCamera | 显示摄像头' },
            name: 'isShowCamera',
            setter: 'BoolSetter',
          },
          {
            title: { label: '显示NFC', tip: 'isShowNFC | 显示NFC' },
            name: 'isShowNFC',
            setter: 'BoolSetter',
          },
          {
            title: { label: '样式', tip: 'style | 样式' },
            name: 'style',
            setter: ['JsonSetter'],
          },
        ],
      },
      {
        title: { label: '列表交互' },
        type: 'group',
        display: 'block',
        items: [
          {
            title: { label: '点击行回调', tip: 'onRowClick | 点击行回调' },
            name: 'onRowClick',
            setter: 'FunctionSetter',
          },
          {
            title: { label: '新增客户回调', tip: 'onAddClient | 新增客户回调' },
            name: 'onAddClient',
            setter: 'FunctionSetter',
          },
          {
            title: { label: '触底加载', tip: 'onLoadMore | 触底加载回调' },
            name: 'onLoadMore',
            setter: 'FunctionSetter',
          },
          {
            title: { label: '是否还有更多', tip: 'hasMore | 是否还有更多数据' },
            name: 'hasMore',
            setter: 'BoolSetter',
            defaultValue: false,
          },
        ],
      },
      {
        title: { label: '搜索事件' },
        type: 'group',
        display: 'block',
        items: [
          {
            title: { label: '关键字变化', tip: 'onKeywordChange | 关键字变化' },
            name: 'onKeywordChange',
            setter: 'FunctionSetter',
          },
          {
            title: { label: '搜索回调', tip: 'onSearch | 搜索回调' },
            name: 'onSearch',
            setter: 'FunctionSetter',
          },
          {
            title: { label: '数据变化', tip: 'onDataChange | 数据变化' },
            name: 'onDataChange',
            setter: 'FunctionSetter',
          },
        ],
      },
    ],
    component: {
      isModal: true,
      nestingRule: {
        parentWhitelist: ['Page', 'Component'],
      },
    },
    supports: {
      events: [
        {
          name: 'onRowClick',
        },
        {
          name: 'onAddClient',
        },
        {
          name: 'onLoadMore',
        },
        {
          name: 'onKeywordChange',
        },
        {
          name: 'onSearch',
        },
        {
          name: 'onDataChange',
        },
      ],
      style: true,
    },
  },
};

const snippets = [
  {
    title: '客户搜索',
    screenshot: '',
    schema: {
      componentName: 'ClientSearch',
      props: {
        isShowSearch: true,
        isShowNewButton: true,
        hasMore: false,
      },
    },
  },
];

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