/*
 * @Author: liuJie
 * @Date: 2026-02-26 13:57:24
 * @LastEditors: liuJie
 * @LastEditTime: 2026-02-27 15:26:22
 * @Describe: file describe
 */
import { FormConfig } from '@/types/basic-form';

export const INVENTORY_FORM_CONFIG: FormConfig[] = [
  {
    prop: 'itemName',
    label: '奖品名称：',
    component: 'ElInput',
    componentProps: {
      placeholder: '请输入奖品名称',
    },
  },
  {
    prop: 'warehouseDate',
    label: '入库日期：',
    component: 'ElDatePicker',
    componentProps: {
      type: 'date',
      placeholder: '请选择入库日期',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    prop: 'itemQuantity',
    label: '奖品数量：',
    component: 'ElInputNumber',
    componentProps: {
      min: 1,
      max: 99999,
      precision: 0, // 不允许小数点，只能输入整数
      placeholder: '请输入奖品数量',
    },
  },
  {
    label: '备注：',
    prop: 'remarks',
    component: 'ElInput',
    componentProps: {
      type: 'textarea',
      rows: 5,
      placeholder: '请输入备注',
    },
  },
  {
    prop: 'status',
    label: '状态：',
    slot: 'status',
  },
];

export const INVENTORY_FORM_DATA = {
  status: 'ENABLE',
  itemName: '',
  warehouseDate: '',
  itemQuantity: 1, // 最小值为1
  remarks: '',
};

export const INVENTORY_FORM_RULES = {
  status: [{ required: true, message: '请选择状态', trigger: 'change' }],
  itemName: [{ required: true, message: '请输入奖品名称', trigger: 'blur' }],
  warehouseDate: [{ required: true, message: '请选择入库日期', trigger: 'change' }],
  itemQuantity: [
    { required: true, message: '请输入奖品数量', trigger: 'blur' },
    { type: 'number', min: 1, message: '奖品数量不能小于1', trigger: 'blur' },
    { type: 'number', max: 99999, message: '奖品数量不能大于99999', trigger: 'blur' },
  ],
};
