from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.sql import func
from sqlalchemy.orm import relationship
from app.db.database import Base

class MTGJSONSKU(Base):
    __tablename__ = "mtgjson_skus"

    id = Column(Integer, primary_key=True, index=True)
    sku_id = Column(String, index=True)
    product_id = Column(String, index=True)
    condition = Column(String)
    finish = Column(String)
    language = Column(String)
    printing = Column(String)
    card_id = Column(String, ForeignKey("mtgjson_cards.card_id"))
    created_at = Column(DateTime(timezone=True), server_default=func.current_timestamp())
    updated_at = Column(DateTime(timezone=True), onupdate=func.current_timestamp())

    # Relationships
    card = relationship("MTGJSONCard", back_populates="skus") 