module.exports = function (sequelize, DataTypes) {
    const Value = sequelize.define('Value', {
        id: {
            type: DataTypes.UUID,
            defaultValue: DataTypes.UUIDV4,
            primaryKey: true,
        },
        name: {
            type: DataTypes.STRING,
            allowNull: false
        },
    }, {
        tableName: 'values',
        freezeTableName: true,
        timestamps: true,
    });

    Value.associate = function (models) {
       
        Value.Speakers = Value.belongsToMany(models.Speaker, {
            through: models.SpeakerValue,
            foreignKey: 'valueId',
            as: 'speakers'
        });
    };

    return Value;
};