from __future__ import annotations

from dataclasses import dataclass, field, asdict


@dataclass
class SearchResult:
    id: str
    texto: str
    raw: dict
    fecha: str | None = None
    tribunal: str | None = None
    caratula: str | None = None
    voces: list[str] = field(default_factory=list)
    url: str | None = None

    def as_dict(self) -> dict:
        return asdict(self)


@dataclass
class JurisDocument:
    id: str
    texto_completo: str
    fecha: str | None = None
    tribunal: str | None = None
    caratula: str | None = None
    magistrados: list[str] = field(default_factory=list)
    normas: list[str] = field(default_factory=list)
    metadata: dict = field(default_factory=dict)

    def as_dict(self) -> dict:
        return asdict(self)
