'use strict';
module.exports = (sequelize, DataTypes) => {
  const OurTeamMember = sequelize.define('OurTeamMember', {
    name: {
      type: DataTypes.STRING,
      allowNull: false
    },
    title: {
      type: DataTypes.STRING,
      allowNull: false
    },
    role: {
      type: DataTypes.ENUM('coordinator', 'executive'),
      allowNull: false
    },
    imagePath: {
      type: DataTypes.STRING,
      allowNull: false
    },
    yearId: {
      type: DataTypes.INTEGER,
      references: {
        model: 'TeamYears',
        key: 'id'
      }
    }
  });

  OurTeamMember.associate = models => {
    OurTeamMember.belongsTo(models.TeamYear, {
      foreignKey: 'yearId'
    });
  };

  return OurTeamMember;
};
