"use strict";

module.exports = function(sequelize, DataTypes) {
  var SensorLocation = sequelize.define('SensorLocation', {
    address: {type: DataTypes.INTEGER, unique: true, primaryKey: true},
    nombre: DataTypes.STRING
    }, {
    classMethods: {
      associate: function(models) {
        SensorLocation.hasOne(models.Sensor, {foreignKey: 'address'});
        SensorLocation.hasOne(models.Event, {foreignKey: 'address'});
        SensorLocation.hasOne(models.PerMinutesMeanEvent, {foreignKey: 'address'});
        SensorLocation.hasOne(models.PerHoursMeanEvent, {foreignKey: 'address'});
        SensorLocation.hasOne(models.CostEvent, {foreignKey: 'address'});
      }
    }
  });

  return SensorLocation;
};