"use strict";

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

  return CostEvent;
};