from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, ConfigDict, Field


class MedicationPertinenceReviewItem(BaseModel):
    model_config = ConfigDict(populate_by_name=True, extra="ignore", str_strip_whitespace=True)

    key: str = Field(alias="k")
    estado: Literal["pertinente", "revisar", "posible_glosa"] = Field(alias="e")
    justificacion: str = Field(default="", alias="j")
    evidence_ids: list[str] = Field(default_factory=list, alias="ev")


class MedicationPertinenceReviewCollection(BaseModel):
    model_config = ConfigDict(populate_by_name=True, extra="ignore")

    schema_version: Literal["v2"] = Field(default="v2", alias="sv")
    items: list[MedicationPertinenceReviewItem] = Field(default_factory=list, alias="it")
