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


class CCPackage(Base):
    """CC charging packages"""
    __tablename__ = "cc_packages"

    id = Column(Integer, primary_key=True, index=True)
    name = Column(String(50), nullable=False)  # e.g., "Basic", "Standard", "Premium"
    price_usd = Column(Integer, nullable=False)  # Price in USD (10, 27, 40)
    cc_amount = Column(Integer, nullable=False)  # CC amount (10, 30, 50)
    bonus_cc = Column(Integer, default=0)  # Bonus CC (0, 3, 10)
    discount_percent = Column(Integer, default=0)  # Discount percentage (0, 10, 20)
    is_active = Column(Boolean, default=True)
    sort_order = Column(Integer, default=0)

    # Stripe Price ID for recurring or one-time payments
    stripe_price_id = Column(String(100), nullable=True)


# Default CC packages
DEFAULT_CC_PACKAGES = [
    {
        "name": "Basic",
        "price_usd": 10,
        "cc_amount": 10,
        "bonus_cc": 0,
        "discount_percent": 0,
        "sort_order": 1,
    },
    {
        "name": "Standard",
        "price_usd": 27,
        "cc_amount": 27,
        "bonus_cc": 3,
        "discount_percent": 10,
        "sort_order": 2,
    },
    {
        "name": "Premium",
        "price_usd": 40,
        "cc_amount": 40,
        "bonus_cc": 10,
        "discount_percent": 20,
        "sort_order": 3,
    },
]
