from app.core.database import Base
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Enum
from sqlalchemy.orm import relationship
from datetime import datetime
import enum

class TopupStatus(enum.Enum):
    pending = "pending"
    confirmed = "confirmed"
    rejected = "rejected"

class Topup(Base):
    __tablename__ = "topups"

    id = Column(Integer, primary_key=True, index=True)
    user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
    amount_cents = Column(Integer, nullable=False)
    status = Column(Enum(TopupStatus), default=TopupStatus.pending, nullable=False)
    created_at = Column(DateTime, default=datetime.utcnow)
    confirmed_at = Column(DateTime, nullable=True)
    paypal_email = Column(String, nullable=True)
    note = Column(String, nullable=True)


    user = relationship("User")
