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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .dose_classification_confidence import DoseClassificationConfidence
from .dose_classification_reaction_type import DoseClassificationReactionType


class DoseClassification(UniversalBaseModel):
    """
    WHO DDD-based dose-response classification.
    Type A reactions are dose-dependent and predictable.
    Type B reactions are idiosyncratic and unpredictable.
    """

    reaction_type: typing.Optional[DoseClassificationReactionType] = pydantic.Field(default=None)
    """
    Primary reaction type.
    - `A` — Dose-dependent (augmented). Predictable from pharmacology.
    - `B` — Idiosyncratic (bizarre). Unpredictable, not dose-related.
    """

    basis: typing.Optional[str] = pydantic.Field(default=None)
    """
    Classification rationale
    """

    has_idiosyncratic: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether any idiosyncratic (Type B) reactions exist
    """

    idiosyncratic_effects: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    List of known idiosyncratic effects
    """

    confidence: typing.Optional[DoseClassificationConfidence] = pydantic.Field(default=None)
    """
    Confidence in the classification
    """

    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
