const Sequelize = require('sequelize');
const Model = Sequelize.Model;

module.exports = (sequelize) => {
    class Phone extends Model {
        static associate(db) {
            Phone.belongsTo(db.Person, {onDelete: 'cascade'});
        };
    }

    Phone.init({
        number: Sequelize.STRING,
        type: Sequelize.ENUM('home', 'work')

    }, {sequelize, modelName: 'Phone'});

    return Phone
};