'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class MpesaPayment extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
      MpesaPayment.belongsTo(models.TransactionPayment, { foreignKey: 'transactionPaymentId', as: 'transactionPayments' });
    }
  }
  MpesaPayment.init({
    transactionPaymentId: DataTypes.INTEGER,
    CheckoutRequestID: DataTypes.STRING,
    MerchantRequestID: DataTypes.STRING,
    PhoneNumber: DataTypes.STRING,
    Amount: DataTypes.DECIMAL,
    AccountReference: DataTypes.STRING,
    TransactionDesc: DataTypes.STRING,
    status: DataTypes.STRING,
    MpesaReceiptNumber: DataTypes.STRING,
    TransactionDate: DataTypes.STRING,
    ResultDesc: DataTypes.TEXT,
    orderId: DataTypes.STRING
  }, {
    sequelize,
    modelName: 'MpesaPayment',
  });
  return MpesaPayment;
};