import mongoose from "mongoose";

const paymentSchema = new mongoose.Schema({
  email: { type: String, required: true },
  amount: { type: Number, required: true }, // store in cents
  currency: { type: String, default: "usd" },
  stripePaymentIntentId: { type: String }, // ❌ remove required: true
  stripeSessionId: { type: String },       // ✅ store Checkout Session ID
  status: { type: String, default: "pending" }, // pending, succeeded, failed
}, { timestamps: true });

export const Payment = mongoose.model("Payment", paymentSchema);
