'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
	async up(queryInterface, Sequelize) {
		await queryInterface.dropTable('activity_bookings');
	},

	async down(queryInterface, Sequelize) {
		await queryInterface.createTable('activity_bookings', {
			id: {
				type: Sequelize.UUID,
				defaultValue: Sequelize.UUIDV4,
				primaryKey: true,
				allowNull: false,
			},
			reference_no: {
				type: Sequelize.STRING,
				allowNull: false,
			},
			activity_id: {
				type: Sequelize.UUID,
				allowNull: false,
			},
			member_id: {
				type: Sequelize.UUID,
				allowNull: false,
			},
			payment_status: {
				type: Sequelize.ENUM('Unpaid', 'Partially Paid', 'Paid'),
				allowNull: false,
				defaultValue: 'Unpaid',
			},
			payment_method: {
				type: Sequelize.STRING,
				allowNull: true,
			},
			payment: {
				type: Sequelize.DECIMAL(10, 2),
				allowNull: false,
				defaultValue: 0.0,
			},
			date_time: {
				type: Sequelize.DATE,
				allowNull: false,
			},
			participants: {
				type: Sequelize.INTEGER,
				allowNull: false,
				defaultValue: 1,
			},
			price: {
				type: Sequelize.DECIMAL(10, 2),
				allowNull: false,
			},
			price_type: {
				type: Sequelize.ENUM('per person', 'fixed'),
				allowNull: false,
				defaultValue: 'per person',
			},
			total: {
				type: Sequelize.DECIMAL(10, 2),
				allowNull: false,
			},
			status: {
				type: Sequelize.ENUM('Unpaid', 'Completed', 'Pending'),
				allowNull: false,
				defaultValue: 'Unpaid',
			},
		});
	},
};
