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 },
        
        udk_id: { type: DataTypes.STRING, allowNull: true },
        no_udk: { type: DataTypes.STRING, allowNull: true },
        date: { type: DataTypes.DATE, allowNull: true },
        customer: { type: DataTypes.STRING, allowNull: true },
        address: { type: DataTypes.STRING, allowNull: true },
        top: { type: DataTypes.STRING, allowNull: true },
        periode: { type: DataTypes.STRING, allowNull: true },
        pic: { type: DataTypes.STRING, allowNull: true },
        email: { type: DataTypes.STRING, allowNull: true },
        phone_number: { type: DataTypes.STRING, allowNull: true },
        distribution: { type: DataTypes.STRING, allowNull: true },
        product: { type: DataTypes.JSON, allowNull: true },
        price: { type: DataTypes.JSON, allowNull: true },
        is_tax: { type: DataTypes.BOOLEAN, allowNull: true },
        
        approval_request: { type: DataTypes.JSON, allowNull: true },
        approver: { type: DataTypes.JSON, allowNull: true },
        
        
        other_discount: { type: DataTypes.JSON, allowNull: true },

        // Quotation
        price_quotation: { type: DataTypes.JSON, allowNull: true },

        // required for Sales Order
        naming_series:{ type: DataTypes.STRING, allowNull: true },
        po_no:{ type: DataTypes.STRING, allowNull: true },
        po_date: { type: DataTypes.DATE, allowNull: true },
        
        company: { type: DataTypes.STRING, allowNull: false },
    };

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