const mongoose = require("mongoose");

const paymentSchema = new mongoose.Schema(
    {
        userId: Number,
        type: { type: Number, enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 33, 77, 78, 79, 88, 13, 14, 15, 16, 17, 756] }, // 0:gift, 1:convert, 2:purchase [coin purchase], 3:call, 4:ad[from watching ad], 5:login bonus, 6:referral bonus, 7: cashOut, 8: private message, 9: inbox message, 10: store purchase, 11: vip purchase, 12: admin [admin add or less the rCoin or diamond through admin panel], 33: teenpatti, 77: lucky 77, 78: lucky gifting, 79: lucky wheel, 88: greedy, 13: task, 14: task exchange, 15: salary, 16: spotlight, 17: treasure box
        diamond: { type: Number, default: 0 },
        coin: { type: Number, default: 0 },
        otherUserId: { type: Number, default: null },
        date: String,
        isIncome: { type: Boolean, default: true },
        paymentGateway: { type: String, default: null },
        extra_data: { type: String, default: "" },
        ip_addr: { type: String, default: "" },
        u_agent: { type: String, default: "" },
    },
    {
        timestamps: true,
        versionKey: false,
    }
);

module.exports = mongoose.model("payment", paymentSchema);
