# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...core.serialization import FieldMetadata
from .construe_cohort_response_queries_item_code_extract_results_item import (
    ConstrueCohortResponseQueriesItemCodeExtractResultsItem,
)


class ConstrueCohortResponseQueriesItem(UniversalBaseModel):
    resource: typing.Optional[str] = pydantic.Field(default=None)
    """
    FHIR resource type (e.g., "Patient", "Condition").
    """

    search_params: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="searchParams")] = (
        pydantic.Field(default=None)
    )
    """
    FHIR search parameters.
    """

    exclude: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Indicates if this is an exclusion criteria.
    """

    rationale: typing.Optional[str] = pydantic.Field(default=None)
    """
    AI-generated explanation for the query component.
    """

    code_extract_results: typing_extensions.Annotated[
        typing.Optional[typing.List[ConstrueCohortResponseQueriesItemCodeExtractResultsItem]],
        FieldMetadata(alias="codeExtractResults"),
    ] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
