import { FormConfig } from '@/types/basic-form';

export const ACCESS_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'eventDescription',
    label: '事件描述：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入事件的具体描述',
      type: 'textarea',
      rows: 5,
      maxlength: 500,
      showWordLimit: true,
    },
  },
  {
    prop: 'eventLocation',
    label: '事件地点：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入事件发生地点',
      maxlength: 200,
      showWordLimit: true,
    },
  },
  {
    prop: 'eventTime',
    label: '事件时间：',
    component: 'ElDatePicker',
    componentProps: {
      placeholder: '请选择事件发生时间',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      dateFormat: 'MMM DD, YYYY',
      timeFormat: 'HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      disabledDate: (time) => time.getTime() > Date.now(),
    },
  },
  {
    prop: 'images',
    label: '抓拍照片：',
    slot: 'images',
  },
  {
    label: '备注：',
    prop: 'remark',
    component: 'ElInput',
    componentProps: {
      type: 'textarea',
      rows: 5,
    },
  },
  {
    label: '创建人：',
    prop: 'createdByName',
    component: 'ElInput',
    componentProps: {
      disabled: true,
    },
  },
];

export const ACCESS_FORM_DATA = {
  eventDescription: '',
  eventLocation: '',
  eventTime: '',
  images: [],
  remark: '',
  createdByName: '',
};

export const ACCESS_FORM_RULES = {
  eventDescription: [{ required: true, message: '请输入事件的具体描述', trigger: 'blur' }],
  eventLocation: [{ required: true, message: '请输入事件发生地点', trigger: 'blur' }],
  eventTime: [{ required: true, message: '请选择事件发生时间', trigger: 'change' }],
};
