'use strict';
module.exports = function(sequelize, DataTypes) {
  var Question = sequelize.define('Question', {
    title: DataTypes.STRING,
    points: DataTypes.INTEGER,
    question: DataTypes.STRING,
    hint: DataTypes.STRING,
    key: DataTypes.STRING,
    flag: DataTypes.STRING
  }, {
    classMethods: {
      associate: function(models) {
        Question.belongsTo(models.Category, { foreignKey: 'category_id' });
        Question.hasMany(models.Solution, {foreignKey: 'solution_id'});
      }
    }
  });
  return Question;
};
