"""Vaccination model for vaccine records."""
from datetime import UTC, datetime
from functools import partial
from typing import Optional

from pydantic import Field

from .types import PyObjectId
from .base import BaseDocument

class Vaccination(BaseDocument):
    """Vaccination model representing vaccine records."""
    vaccineId: str = Field(description="Unique identifier for the vaccine")
    patientId: PyObjectId = Field(
        description="ID of the patient who received the vaccine"
    )
    name: str = Field(description="Name of the vaccine")
    administeredDate: datetime = Field(
        default_factory=partial(datetime.now, UTC),
        description="Date when the vaccine was administered in UTC"
    )
    administrationPlace: str = Field(
        description="Name of the hospital where the vaccine was administered"
    )
    hospitalVisitId: Optional[PyObjectId] = Field(
        default=None, description="ID of the hospital visit during which this vaccine was given"
    )
