"use strict";

module.exports = function(sequelize, DataTypes) {
  var Chart =  sequelize.define('Chart', {
	id: {type: DataTypes.STRING, unique: false, autoIncrement: true, primaryKey: true},
	nombre: DataTypes.STRING(50),
	tipo: DataTypes.INTEGER(2),
	formato: DataTypes.STRING(20),
	botones: DataTypes.BOOLEAN
  }, {
    classMethods: {
      associate: function(models) {
        Chart.hasMany(models.PageChart, {foreignKey: 'idChart'});
        Chart.belongsTo(models.SensorDetails, {foreignKey: 'tipo'});
      }
    }
  });

  return Chart;
};