import os
from pathlib import Path
from typing import Dict

CV_DIR = Path(__file__).parent
DATA_DIR = CV_DIR / "data"
MODELS_DIR = CV_DIR / "models"

DATA_DIR.mkdir(parents=True, exist_ok=True)
MODELS_DIR.mkdir(parents=True, exist_ok=True)

try:
    from ultralytics import YOLO
    ULTRALYTICS_AVAILABLE = True
except ImportError:
    ULTRALYTICS_AVAILABLE = False
    YOLO = None

YOLO26_MODELS: Dict[str, str] = {
    "nano": "yolo26n.pt",
    "small": "yolo26s.pt",
    "medium": "yolo26m.pt",
    "large": "yolo26l.pt",
    "xlarge": "yolo26x.pt",
}

SUPER_CATEGORIES: Dict[str, int] = {
    "Food": 932,
    "Clothes": 604,
    "Necessities": 432,
    "Others": 371,
    "Electronic": 224,
    "Transportation": 213,
    "Leisure": 111,
    "Sports": 66,
    "Medical": 47
}

COMMON_BRANDS = [
    "McDonalds", "Starbucks", "CocaCola", "Pepsi", "KFC", "BurgerKing", 
    "Subway", "DunkinDonuts", "PizzaHut", "Dominos", "Nestle", "Heineken",
    "Nike", "Adidas", "Puma", "UnderArmour", "Levis", "HM", "Zara", "Gap",
    "Gucci", "LouisVuitton", "Chanel", "Versace", "Prada", "Armani",
    "Apple", "Samsung", "HP", "Dell", "Intel", "AMD", "Nvidia", "Microsoft",
    "Sony", "LG", "Huawei", "Xiaomi", "Lenovo", "Asus", "Acer",
    "BMW", "Mercedes", "Audi", "Toyota", "Honda", "Ford", "Chevrolet",
    "Volkswagen", "Tesla", "Porsche", "Ferrari", "Lamborghini", "Nissan",
    "Google", "Facebook", "Twitter", "Instagram", "YouTube", "Amazon",
    "Netflix", "Spotify", "Uber", "Airbnb", "PayPal", "Visa", "Mastercard"
]

COLORS = {
    "high_conf": (0, 255, 0),
    "medium_conf": (0, 255, 255),
    "low_conf": (0, 165, 255),
    "logo": (255, 0, 255),
}

DEFAULT_CONF_THRESHOLD = 0.25
DEFAULT_IOU_THRESHOLD = 0.45
DEFAULT_IMG_SIZE = 640
