from pydantic import BaseModel, Field
from datetime import date
from typing import Optional


class PossibleTest(BaseModel):
    """Represents a concrete test record the model can choose from."""
    test_id: str = Field(description="Database id of the test record")
    test_name: str = Field(description="Display name of the test record")
    subtest_names: list[str] = Field(default_factory=list, description="Names of subtests contained in this test record")

class TestQuery(BaseModel):
    """Represents test and a date range with start and end."""
    test_id: Optional[str] = Field(default=None, description="Database id of the matched test record, if one was identified")
    test_parameter: str = Field(description="The name of the bloodwork test this date range applies to")
    start: Optional[date] = Field(default=None, description="Start date of the range (inclusive), in ISO format")
    end: Optional[date] = Field(default=None, description="End date of the range (inclusive), in ISO format")
    text: str = Field(description="Original text from the query that led to this date range, for debugging purposes")