import type {
  ProColumns,
  ProDescriptionsItemProps,
  ProFormColumnsType,
} from '@ant-design/pro-components';
import dayjs from 'dayjs';
import type { NoticeVO } from '@/services/system/message/notice';
export const baseTenantColumns: ProColumns<NoticeVO>[] = [
  {
    title: '公告编号',
    dataIndex: 'id',
    width: 100,
    hideInSearch: true,
  },
  {
    title: '公告标题',
    dataIndex: 'title',
  },
  {
    title: '公告类型',
    dataIndex: 'type',
    hideInSearch: true, // 在搜索表单中隐藏
  },
  {
    title: '状态',
    dataIndex: 'status',
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    valueType: 'dateRange',
    hideInSearch: true,
    render: (_, record: NoticeVO) =>
      dayjs(record.createTime).format('YYYY-MM-DD HH:mm:ss'),
  },
];

export const formColumns = (type: string): ProFormColumnsType[] => [
  {
    title: '公告标题',
    dataIndex: 'title',
    tip: '公告标题', // 提示信息
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入用户名',
        },
      ],
    },
  },
  {
    title: '公告内容',
    dataIndex: 'content',
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入公告内容',
        },
      ],
    },
  },
  {
    title: '公告类型',
    dataIndex: 'type',
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请输入公告类型',
        },
      ],
    },
  },
  {
    title: '状态',
    dataIndex: 'status',
    valueType: 'select',
    fieldProps: {
      options: [
        {
          label: '正常',
          value: 1,
        },
        {
          label: '禁用',
          value: 2,
        },
      ],
    },
    formItemProps: {
      rules: [
        {
          required: true,
          message: '请选择状态',
        },
      ],
    },
  },
  {
    title: '备注',
    dataIndex: 'username',
  },
];
