import os
from pathlib import Path

# Thư mục gốc dự án
BASE_DIR = Path(__file__).resolve().parent.parent
GRADIO_DIR = BASE_DIR / "gradio_version"
OUTPUTS_DIR = GRADIO_DIR / "outputs"
ASSETS_VIDEOS_DIR = BASE_DIR / "04_Assets" / "videos"
ASSETS_KEYFRAMES_DIR = BASE_DIR / "04_Assets" / "keyframes"

# Cấu hình Token Hugging Face (Tùy chọn, để tăng quota/ưu tiên hàng đợi)
HF_TOKEN = os.getenv("HF_TOKEN", "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")

# Danh mục các Hugging Face Spaces I2V hàng đầu (Tháng 10/2026)
SUPPORTED_SPACES = {
    "ltx": {
        "name": "LTX-Video (Lightricks Distilled)",
        "space_id": "Lightricks/ltx-video-distilled",
        "api_endpoint": "/image_to_video",
        "type": "direct_predict",
        "default_width": 704,
        "default_height": 512,
        "default_duration": 4.0,
        "speed": "Rất nhanh (~15-30s)",
        "cost": "0 USD (ZeroGPU Free)"
    },
    "wan21": {
        "name": "Alibaba Wan 2.1 (Wan-Video I2V)",
        "space_id": "Wan-AI/Wan2.1",
        "api_endpoint": "/i2v_generation_async",
        "type": "async_polling",
        "default_width": 1280,
        "default_height": 720,
        "speed": "Trung bình (~60-120s)",
        "cost": "0 USD (ZeroGPU Free)"
    },
    "cogvideox": {
        "name": "THUDM CogVideoX-5B",
        "space_id": "zai-org/CogVideoX-5B-Space",
        "api_endpoint": "/generate",
        "type": "direct_predict",
        "speed": "Trung bình (~45-90s)",
        "cost": "0 USD (ZeroGPU Free)"
    },
    "wan22": {
        "name": "Alibaba Wan 2.2 FP8 AoTI Faster",
        "space_id": "zerogpu-aoti/wan2-2-fp8da-aoti-faster",
        "api_endpoint": "/generate_video",
        "type": "direct_predict",
        "default_duration": 4.0,
        "speed": "Siêu tốc (~15-30s với 6 steps AoTI)",
        "cost": "0 USD (ZeroGPU Free)"
    }
}

DEFAULT_MODEL = "ltx"

NEGATIVE_PROMPT_DEFAULT = "worst quality, inconsistent motion, blurry, jittery, distorted, cartoonish, low resolution, noisy, bad anatomy"
