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

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

    PostalAddress.init({
        postalAddress: Sequelize.STRING,
        type: Sequelize.ENUM('home', 'work')
    }, {sequelize, modelName: 'PostalAddress'});

    return PostalAddress;

};