module.exports = (sequelize, DataTypes) => {
	const Events = sequelize.define(
		'Events',
		{
			id: {
				type: DataTypes.UUID,
				defaultValue: DataTypes.UUIDV4,
				allowNull: false,
				primaryKey: true,
			},
			event_type: {
				type: DataTypes.ENUM('Free', 'Requires Payment'),
				allowNull: false,
				defaultValue: 'Requires Payment',
			},
			organizer: {
				type: DataTypes.STRING,
				allowNull: false,
			},
			title: {
				type: DataTypes.STRING,
				allowNull: false,
			},
			description: {
				type: DataTypes.TEXT('long'),
				allowNull: false,
			},
			location: {
				type: DataTypes.STRING,
				allowNull: false,
			},
			start_date: {
				type: DataTypes.DATEONLY,
				allowNull: false,
			},
			end_date: {
				type: DataTypes.DATEONLY,
				allowNull: false,
			},
			start_time: {
				type: DataTypes.TIME,
				allowNull: false,
			},
			end_time: {
				type: DataTypes.TIME,
				allowNull: false,
			},
			max_participants: {
				type: DataTypes.INTEGER,
				allowNull: false,
			},
			current_participants: {
				type: DataTypes.INTEGER,
				defaultValue: 0,
			},
			spots_left: {
				type: DataTypes.INTEGER,
				allowNull: false,
			},
			price: {
				type: DataTypes.DECIMAL(10, 2),
				defaultValue: 0.0,
			},
			status: {
				type: DataTypes.ENUM('Upcoming', 'Ongoing', 'Done', 'Cancelled'),
				defaultValue: 'Upcoming',
			},
			image: {
				type: DataTypes.STRING,
				allowNull: false,
			},
			longitude: {
				type: DataTypes.DECIMAL(11, 8),
				allowNull: false,
			},
			latitude: {
				type: DataTypes.DECIMAL(10, 8),
				allowNull: false,
			},
			registration_start: {
				type: DataTypes.DATE,
				allowNull: false,
			},
			registration_end: {
				type: DataTypes.DATE,
				allowNull: false,
			},
			createdAt: {
				type: DataTypes.DATE,
				allowNull: false,
				defaultValue: DataTypes.NOW,
			},
			updatedAt: {
				type: DataTypes.DATE,
				allowNull: false,
				defaultValue: DataTypes.NOW,
			},
		},
		{
			tableName: 'events',
			timestamps: false,
		},
	);

	return Events;
};
