from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Dict, Optional


@dataclass
class EvidenceFileData:
    file_id: str
    file_name: str
    created_utc: str
    file_size: int
    file_extension: str

    evidence_category: Optional[str] = None

    @classmethod
    def from_api(cls, data: Dict[str, Any]) -> EvidenceFileData:
        return cls(
            file_id=data["fileId"],
            file_name=data["fileName"],
            created_utc=data["createdUtc"],
            file_size=data["fileSize"],
            file_extension=data["fileExtension"],
            evidence_category=data.get("evidenceCategory"),
        )
