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

const Activity = sequelize.define('Activity', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  title: {
    type: DataTypes.STRING,
    allowNull: false
  },
  description: DataTypes.TEXT,
  location: DataTypes.STRING,
  locationLat: DataTypes.DECIMAL(10, 7),
  locationLng: DataTypes.DECIMAL(10, 7),
  startTime: DataTypes.DATE,
  endTime: DataTypes.DATE,
  registrationDeadline: DataTypes.DATE,
  maxParticipants: DataTypes.INTEGER,
  status: {
    type: DataTypes.ENUM('upcoming', 'ongoing', 'completed'),
    defaultValue: 'upcoming'
  },
  registrationEnabled: {
    type: DataTypes.BOOLEAN,
    defaultValue: true,
    comment: '报名开关'
  },
  coverImage: DataTypes.STRING,
  price: {
    type: DataTypes.DECIMAL(10, 2),
    defaultValue: 0,
    comment: '人均费用'
  },
  budget: {
    type: DataTypes.DECIMAL(10, 2),
    defaultValue: 0,
    comment: '活动预算'
  }
});

module.exports = Activity;
