const { UUID, UUIDV4 } = require('sequelize');

module.exports = (sequelize, DataTypes) => {
	const CommentLikes = sequelize.define(
		'CommentLikes',
		{
			id: {
				type: UUID,
				defaultValue: UUIDV4,
				primaryKey: true,
				allowNull: false,
			},
			comment_id: {
				type: UUID,
				allowNull: false,
			},
			member_id: {
				type: UUID,
				allowNull: false,
			},
		},
		{
			tableName: 'comment_likes',
			timestamps: false,
		},
	);

	CommentLikes.associate = (models) => {
		CommentLikes.belongsTo(models.Members, { as: 'member', foreignKey: 'member_id' });
	};

	return CommentLikes;
};
