from __future__ import annotations

from datetime import datetime, timezone
from pathlib import Path


class TraceFilePathBuilder:
    def __init__(self, root: Path) -> None:
        self._root = root

    def build(self, request_id: str) -> Path:
        stamp = datetime.now(timezone.utc).strftime("%Y%m%d")
        directory = self._root / stamp
        directory.mkdir(parents=True, exist_ok=True)
        return directory / f"{request_id}.md"
