import { BasicColumn, FormSchema } from '@/components/Table';
import { useI18n } from '@/hooks/web/useI18n';
import { formatToDateTime } from '@/utils/dateUtil';
import { updateContact } from '@/api/wechat/contact';
import { Switch } from 'ant-design-vue';
import { h } from 'vue';
const { t } = useI18n();

export const columns: BasicColumn[] = [
  {
    title: t('wechat.contact.wxWxid'),
    dataIndex: 'wxWxid',
    width: 100,
  },
  {
    title: t('wechat.contact.type'),
    dataIndex: 'type',
    width: 100,
  },
  {
    title: t('wechat.contact.wxid'),
    dataIndex: 'wxid',
    width: 100,
  },
  {
    title: t('wechat.contact.nickname'),
    dataIndex: 'nickname',
    width: 100,
  },
  {
    title: t('wechat.contact.lag'),
    dataIndex: 'lag',
    width: 100,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'wxWxid',
    label: t('wechat.contact.wxWxid'),
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'wxid',
    label: t('wechat.contact.wxid'),
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'account',
    label: t('wechat.contact.account'),
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    component: 'Input',
    show: false,
  },
  {
    field: 'wxWxid',
    label: t('wechat.contact.wxWxid'),
    component: 'Input',
    required: true,
  },
  {
    field: 'type',
    label: t('wechat.contact.type'),
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'wxid',
    label: t('wechat.contact.wxid'),
    component: 'Input',
    required: true,
  },
  {
    field: 'account',
    label: t('wechat.contact.account'),
    component: 'Input',
    required: true,
  },
  {
    field: 'nickname',
    label: t('wechat.contact.nickname'),
    component: 'Input',
    required: true,
  },
  {
    field: 'markname',
    label: t('wechat.contact.markname'),
    component: 'Input',
    required: true,
  },
  {
    field: 'headimg',
    label: t('wechat.contact.headimg'),
    component: 'Input',
    required: true,
  },
  {
    field: 'sex',
    label: t('wechat.contact.sex'),
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'starrole',
    label: t('wechat.contact.starrole'),
    component: 'Input',
    required: true,
  },
  {
    field: 'dontseeit',
    label: t('wechat.contact.dontseeit'),
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'dontseeme',
    label: t('wechat.contact.dontseeme'),
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'lag',
    label: t('wechat.contact.lag'),
    component: 'Input',
    required: true,
  },
  {
    field: 'gid',
    label: t('wechat.contact.gid'),
    component: 'Input',
    required: true,
  },
  {
    field: 'gname',
    label: t('wechat.contact.gname'),
    component: 'Input',
    required: true,
  },
  {
    field: 'v3',
    label: t('wechat.contact.v3'),
    component: 'Input',
    required: true,
  },
  {
    field: 'status',
    label: t('wechat.contact.status'),
    component: 'RadioButtonGroup',
    defaultValue: 1,
    componentProps: {
      options: [
        { label: t('common.on'), value: 1 },
        { label: t('common.off'), value: 2 },
      ],
    },
  },
];
