const DataTypes = require('sequelize');

module.exports = model;

function model(sequelize) {
    const attributes = {
        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 },
        enabled: { type: DataTypes.BOOLEAN, allowNull: true },

        customer_name: { type: DataTypes.STRING, allowNull: true },
        customer_type: { type: DataTypes.STRING, allowNull: true },
        territory: { type: DataTypes.STRING, allowNull: true },
        bank_account: { type: DataTypes.STRING, allowNull: true },
        currency: { type: DataTypes.STRING, allowNull: true },
        market_segment: { type: DataTypes.STRING, allowNull: true },
        industry: { type: DataTypes.STRING, allowNull: true },
        website: { type: DataTypes.STRING, allowNull: true },

        address: { type: DataTypes.STRING, allowNull: true },
        ho_address: { type: DataTypes.JSON, allowNull: true },
        plant_address: { type: DataTypes.JSON, allowNull: true },
        am_ae: { type: DataTypes.JSON, allowNull: true },
                
        customer_contact: { type: DataTypes.STRING, allowNull: true },
        pic: { type: DataTypes.JSON, allowNull: true },
        primary_address: { type: DataTypes.STRING, allowNull: true },
        tax_id: { type: DataTypes.STRING, allowNull: true },
        term_of_payment: { type: DataTypes.STRING, allowNull: true },
        
        
        company: { type: DataTypes.STRING, allowNull: false },
    };

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