# services/comfy-agent/app/storage.py
import os
from pathlib import Path
from .config import settings

def ensure_storage() -> None:
    Path(settings.STORAGE_PATH).mkdir(parents=True, exist_ok=True)

def make_job_dir(job_id: str) -> str:
    ensure_storage()
    d = os.path.join(settings.STORAGE_PATH, job_id)
    Path(d).mkdir(parents=True, exist_ok=True)
    return d

def public_url(job_id: str, filename: str) -> str:
    return f"{settings.PUBLIC_BASE_URL}/{job_id}/{filename}"
