"use strict";

module.exports = function(sequelize, DataTypes) {
  var Event =  sequelize.define('Event', {
	date: DataTypes.DATE,
	type: DataTypes.INTEGER,
	value: DataTypes.STRING,
	address: DataTypes.INTEGER,
	comment: DataTypes.TEXT
    }, {
    classMethods: {
      associate: function(models) {
        Event.belongsTo(models.SensorLocation, {foreignKey: 'address'});
      }
    }
  });

  return Event;
};