'use strict';

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

    SpeakerType.associate = function (models) {
        SpeakerType.Speakers = SpeakerType.hasMany(models.Speaker, { foreignKey: 'typeId' });
    };

    return SpeakerType;
};