from dataclasses import dataclass
from typing import Protocol


@dataclass(frozen=True, slots=True)
class ProcessedMaterial:
    content: bytes
    media_type: str
    width: int | None = None
    height: int | None = None


class MaterialPreprocessor(Protocol):
    def process(self, *, content: bytes, media_type: str) -> ProcessedMaterial: ...


class PassthroughMaterialPreprocessor:
    def process(self, *, content: bytes, media_type: str) -> ProcessedMaterial:
        return ProcessedMaterial(content=content, media_type=media_type)
