"use strict";

module.exports = function(sequelize, DataTypes) {
  var SensorDetails = sequelize.define('SensorDetails', {
    tipo: {type: DataTypes.INTEGER, unique: true, primaryKey: true},
    nombre: DataTypes.STRING,
    unidad: DataTypes.STRING,
    evento: DataTypes.STRING
    }, {
    classMethods: {
      associate: function(models) {
        SensorDetails.hasMany(models.Sensor, {foreignKey: 'type'});
        SensorDetails.hasMany(models.Chart, {foreignKey: 'tipo'});
      }
    }
  });

  return SensorDetails;
};