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

const snippets: IPublicTypeSnippet[] = [
  {
    title: '硬件报错提示',
    screenshot: '',
    schema: {
      componentName: 'HardwareErrorTip',
      props: {},
    },
  },
];

const errorTipMeta = {
  snippets,
  componentName: 'HardwareErrorTip',
  title: 'HardwareErrorTip',
  category: '硬件报错提示',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.1',
    exportName: 'HardwareErrorTip',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  props: [
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Statistics Data',
          'zh-CN': '统计数据',
        },
      },
      name: 'statistics',
      setter: {
        componentName: 'JsonSetter',
      },
      defaultValue: {
        fatal: 0,
        critical: 0,
        normal: 0,
        info: 0,
      },
    },
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Error List',
          'zh-CN': '错误列表',
        },
      },
      name: 'errors',
      setter: {
        componentName: 'JsonSetter',
      },
    },
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Log List',
          'zh-CN': '日志列表',
        },
      },
      name: 'logs',
      setter: {
        componentName: 'JsonSetter',
      },
    },
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Active Tab',
          'zh-CN': '当前激活标签',
        },
      },
      name: 'activeTab',
      setter: {
        componentName: 'RadioGroupSetter',
        props: {
          options: [
            {
              title: '错误列表',
              value: 'errors',
            },
            {
              title: '日志列表',
              value: 'logs',
            },
          ],
        },
        initialValue: 'errors',

      },
    },
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Loading Errors',
          'zh-CN': '错误加载状态',
        },
      },
      name: 'isLoadingErrors',
      setter: {
        componentName: 'BoolSetter',
      },
      defaultValue: false,
    },
    {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'Loading Logs',
          'zh-CN': '日志加载状态',
        },
      },
      name: 'isLoadingLogs',
      setter: {
        componentName: 'BoolSetter',
      },
      defaultValue: false,
    },
  ],
  configure: {
    supports: {
      style: true,
      events: [
        {
          name: 'onExportLogs',
          template:
            "onExportLogs(logs,${extParams}){\n// 导出日志\nconsole.log('onExportLogs',logs);}",
        },
        {
          name: 'onCloseError',
          template:
            "onCloseError(error, index, ${extParams}){\n// 关闭错误\nconsole.log('onCloseError', error);}",
        },
        {
          name: 'onTabChange',
          template:
            "onTabChange(activeTab, ${extParams}){\n// 标签切换\nconsole.log('onTabChange', activeTab);}",
        },
      ],
    },
  },
};

export default errorTipMeta;
