const DataTypes = require('sequelize');

module.exports = model;

function model(sequelize) {
    const attributes = {
        // call plan
        creation: { type: DataTypes.DATE, allowNull: false },
        modified: { type: DataTypes.DATE, allowNull: false },
        modified_by: { type: DataTypes.STRING, allowNull: true },
        owner: { type: DataTypes.STRING, allowNull: true },
        submitted: { type: DataTypes.DATE, allowNull: true },
        company: { type: DataTypes.STRING, allowNull: false },
        document_no: { type: DataTypes.STRING, allowNull: false, unique: true },
        doc_approver: { type: DataTypes.JSON, allowNull: false },
        employee_name: { type: DataTypes.STRING, allowNull: true },
        territory: { type: DataTypes.STRING, allowNull: true },
        department: { type: DataTypes.STRING, allowNull: true },
        from_date: { type: DataTypes.DATEONLY, allowNull: true },
        to_date: { type: DataTypes.DATEONLY, allowNull: true },
        doc_status: { type: DataTypes.STRING, allowNull: true },
        yearPlan: { type: DataTypes.STRING, allowNull: true },
        period: { type: DataTypes.STRING, allowNull: true },

        // item list
        customer_list: { type: DataTypes.JSON, allowNull: true },
        item_bycustomer: { type: DataTypes.JSON, allowNull: true },

        // client visit
        visit_date: { type: DataTypes.JSON, allowNull: true },

    };

    return sequelize.define('ASA_CallPlan', attributes);
    
}
