const mongoose = require("mongoose");

const paymentSchema = new mongoose.Schema(
  {
    userId: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
      required: true,
      index: true,
    },
    paymentNumber: { type: String, required: true, unique: true, trim: true },
    amountPaid: { type: Number, required: true, min: 0 },
    paymentDate: { type: Date, required: true },
    receiverName: { type: String, required: true, trim: true },
    serviceRecord: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "ServiceRecord",
      required: true,
    },
  },
  { timestamps: true }
);


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