import type {
  ProColumns,
  ProDescriptionsItemProps,
  ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { SmsTemplateVO } from '@/services/system/message/sms/template';
export const baseTenantColumns: ProColumns<SmsTemplateVO>[] = [
  {
    title: '模板编码',
    dataIndex: 'code',
    width: 100,
  },
  {
    title: '模板名称',
    dataIndex: 'name',
    hideInSearch: true, // 在搜索表单中隐藏
  },
  {
    title: '模板内容',
    dataIndex: 'content',
    hideInSearch: true, // 在搜索表单中隐藏
  },
  {
    title: '短信类型',
    dataIndex: 'type',
  },
  {
    title: '状态',
    dataIndex: 'status',
  },
  {
    title: '备注',
    dataIndex: 'remark',
    hideInSearch: true,
  },
  {
    title: '短信 API 的模板编号',
    dataIndex: 'apiTemplateId',
  },
  {
    title: '短信渠道',
    dataIndex: 'channelCode',
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    valueType: 'dateRange',
    render: (_, record: SmsTemplateVO) =>
      dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
  },
];

export const formColumns = (type: string): ProFormColumnsType[] => [
  {
    title: '短信渠道编号',
    dataIndex: 'channelId',
    valueType: 'select',
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请选择短信渠道编号',
        },
      ],
    },
  },
  {
    title: '短信类型',
    dataIndex: 'type',
    valueType: 'select',
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请选择短信类型',
        },
      ],
    },
  },
  {
    title: '模板编号',
    dataIndex: 'code',
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入模板编号',
        },
      ],
    },
  },
  {
    title: '模板名称',
    dataIndex: 'name',
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入模板名称',
        },
      ],
    },
  },
  {
    title: '模板内容',
    dataIndex: 'type',

    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入模板内容',
        },
      ],
    },
  },
  {
    title: '开启状态',
    dataIndex: 'status',
    valueType: 'select',

    fieldProps: {
      placeholder: '请选择开启状态',
      options: [
        {
          label: '正常',
          value: 1,
        },
        {
          label: '禁用',
          value: 2,
        },
      ],
    },
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请选择状态',
        },
      ],
    },
  },
  {
    title: '短信 API 模板编号',
    dataIndex: 'apiTemplateId',
    fieldProps: {
      placeholder: '请输入短信 API 的模板编号',
    },
  },
  {
    title: '备注',
    dataIndex: 'remark',
    fieldProps: {
      placeholder: '请输入备注',
    },
  },
];

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