import type {
  ProColumns,
  ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { MailAccountVO } from '@/services/system/message/mail/account';
export const baseTenantColumns: ProColumns<MailAccountVO>[] = [
  {
    title: '邮箱',
    dataIndex: 'mail',
    width: 100,
  },
  {
    title: '用户名',
    dataIndex: 'username',
  },
  {
    title: 'SMTP 服务器域名',
    dataIndex: 'host',
    hideInSearch: true, // 在搜索表单中隐藏
  },
  {
    title: 'SMTP 服务器端口',
    dataIndex: 'port',

    hideInSearch: true, // 在搜索表单中隐藏
  },
  {
    title: '是否开启 SSL',
    dataIndex: 'sslEnable',
    valueType: 'radio',
    hideInSearch: true, // 在搜索表单中隐藏
  },
  {
    title: '是否开启 STARTTLS',
    dataIndex: 'starttlsEnable',
    valueType: 'radio',
    hideInSearch: true,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    valueType: 'dateRange',
    hideInSearch: true, // 在搜索表单中隐藏
    render: (_, record: MailAccountVO) =>
      dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
  },
];

export const formColumns = (): ProFormColumnsType[] => [
  {
    title: '邮箱',
    dataIndex: 'mail',
  },
  {
    title: '用户名',
    dataIndex: 'username',
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入用户名',
        },
      ],
    },
  },
  {
    title: '密码',
    dataIndex: 'password',
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入密码',
        },
      ],
    },
  },
  {
    title: 'SMTP 服务器域名',
    dataIndex: 'host',

    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入SMTP 服务器域名',
        },
      ],
    },
  },
  {
    title: 'SMTP 服务器端口',
    dataIndex: 'port',
    valueType: 'digit',
    fieldProps: {
      defaultValue: 465,
    },
    formItemProps: {
      rules: [
        {
          required: true,
          message: 'SMTP 服务器端口',
        },
      ],
    },
  },
  {
    title: '是否开启 SSL',
    dataIndex: 'sslEnable',
    valueType: 'select',
    fieldProps: {
      placeholder: '请选择是否开启 SSL',
      options: [
        {
          label: '正常',
          value: 1,
        },
        {
          label: '禁用',
          value: 2,
        },
      ],
    },
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请选择是否开启 SSL',
        },
      ],
    },
  },
  {
    title: '是否开启 STARTTLS',
    dataIndex: 'starttlsEnable',
    valueType: 'select',
    fieldProps: {
      placeholder: '请选择是否开启 STARTTLS',
      options: [
        {
          label: '正常',
          value: 1,
        },
        {
          label: '禁用',
          value: 2,
        },
      ],
    },
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请选择是否开启 STARTTLS',
        },
      ],
    },
  },
];

export const formTestColumns = (): ProFormColumnsType[] => [
  {
    title: '模板内容',
    dataIndex: 'content',
    valueType: 'textarea',
  },
  {
    title: '手机号',
    dataIndex: 'mobile',
  },
];
// {
//   title: "模板内容",
//   dataIndex: "content",
//   valueType: "textarea",
// },
