from __future__ import annotations

from pathlib import Path
from typing import Union


class LocalStorageBackend:
    def __init__(self, base_path: Union[str, Path] = "./uploads") -> None:
        self.base_path = Path(base_path)

    async def read(self, key: str) -> bytes:
        """Read a file as bytes from local storage.

        Mirrors the interface of remote backends used elsewhere.
        """
        return (self.base_path / key).read_bytes()
