// const { TINYINT, INTEGER } = require('sequelize/types');
// const { Model } = require('sequelize/types');
// const Movie = require('./Movie');

module.exports = (sequelize, dataTypes) => {
	let alias = 'Genre';
	let cols = {
		id: {
			type: dataTypes.BIGINT(10).UNSIGNED,
			primaryKey: true,
			allowNull: false,
			autoIncrement: true,
		},
		// created_at: dataTypes.TIMESTAMP,
		// updated_at: dataTypes.TIMESTAMP,
		name: {
			type: dataTypes.STRING(100),
			allowNull: false,
		},
		ranking: {
			type: dataTypes.BIGINT(10).UNSIGNED,
			allowNull: false,
		},
		active: {
			type: dataTypes.BOOLEAN,
			allowNull: false,
		},
	};
	let config = {
		timestamps: true,
		createdAt: 'created_at',
		updatedAt: 'updated_at',
		deletedAt: false,
	};
	const Genre = sequelize.define(alias, cols, config);

	//Aquí debes realizar lo necesario para crear las relaciones con el modelo (Movie)

	Genre.associate = function (models) {
		Genre.hasMany(models.Movie, {
			as: 'movies',
			foreignKey: 'genre_id',
		});
	};

	return Genre;
};
