// import { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'

const statusOptions = [
  { label: '发送成功', value: 1 },
  { label: '发送失败', value: 2 },
  { label: '排队中', value: 3 },
  { label: '微信端卡住', value: 4 }
]

// CrudSchema：https://doc.iocoder.cn/vue3/crud-schema/
const crudSchemas = reactive([
  {
    label: '发送对象',
    field: 'sendUser',
    isSearch: true,
    isTable: true
  },
  {
    label: '发送内容',
    field: 'content',
    isSearch: false,
    isTable: true
  },
  {
    label: '发送状态',
    field: 'status',
    isSearch: true,
    isTable: true,
    search: {
      component: 'Select',
      api: () => statusOptions,
      componentProps: {
        optionsAlias: {
          labelField: 'label',
          valueField: 'value'
        }
      }
    }
  },
  {
    label: '发送时间',
    field: 'createTime',
    isSearch: true,
    isTable: true,
    formatter: dateFormatter,
    detail: {
      dateFormat: 'YYYY-MM-DD'
    },
    search: {
      component: 'DatePicker',
      componentProps: {
        type: 'daterange',
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD',
        startPlaceholder: '发送时间',
        endPlaceholder: '发送时间'
      }
    }
  }
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
