const { DataTypes } = require('sequelize');
const sequelize = require('./db');

const Expense = sequelize.define('Expense', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  activityId: {
    type: DataTypes.INTEGER,
    allowNull: false
  },
  item: {
    type: DataTypes.STRING,
    allowNull: false
  },
  amount: {
    type: DataTypes.DECIMAL(10, 2),
    allowNull: false
  },
  category: DataTypes.STRING,
  receipt: DataTypes.STRING,
  note: DataTypes.TEXT,
  media: {
    type: DataTypes.JSON,
    defaultValue: [],
    comment: '经费相关照片/视频,最多5个'
  }
});

module.exports = Expense;
