from core.database import Base
from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, Float, Integer, String


class Products(Base):
    __tablename__ = "products"
    __table_args__ = {"extend_existing": True}

    id = Column(Integer, primary_key=True, index=True, autoincrement=True, nullable=False)
    name = Column(String, nullable=False)
    slug = Column(String, nullable=False)
    description = Column(String, nullable=True)
    long_description = Column(String, nullable=True)
    product_type = Column(String, nullable=False)
    price = Column(Float, nullable=False)
    compare_at_price = Column(Float, nullable=True)
    currency = Column(String, nullable=True)
    category_id = Column(Integer, nullable=True)
    tags = Column(String, nullable=True)
    image_url = Column(String, nullable=True)
    gallery = Column(String, nullable=True)
    stock = Column(Integer, nullable=True)
    weight_grams = Column(Integer, nullable=True)
    sku = Column(String, nullable=True)
    download_url = Column(String, nullable=True)
    whmcs_product_id = Column(Integer, nullable=True)
    variants = Column(String, nullable=True)
    is_active = Column(Boolean, nullable=True)
    featured = Column(Boolean, nullable=True)
    created_at = Column(DateTime(timezone=True), default=datetime.now)
    updated_at = Column(DateTime(timezone=True), default=datetime.now, onupdate=datetime.now)