# 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 .interaction_severity_name import InteractionSeverityName


class Interaction(UniversalBaseModel):
    sfrx_id1: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="sfrx_id_1"),
        pydantic.Field(alias="sfrx_id_1", description="sfrx_id of the first drug in the interaction pair"),
    ] = None
    sfrx_id2: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="sfrx_id_2"),
        pydantic.Field(alias="sfrx_id_2", description="sfrx_id of the second drug in the interaction pair"),
    ] = None
    severity: typing.Optional[int] = pydantic.Field(default=None)
    """
    Interaction severity level (clinical interactions only).
    - `1` — Minor: minimal clinical significance
    - `2` — Moderate: may require monitoring or dose adjustment
    - `3` — Major: avoid combination if possible, close monitoring required
    - `4` — Contraindicated: do not use together
    
    The API filters out noise interactions (severity ≤ 0) by default.
    The internal V8 scale extends to -3 (noise) and 0 (unknown),
    but these are never returned in the public response.
    """

    base_severity: typing.Optional[int] = pydantic.Field(default=None)
    """
    Original severity before route-based or noise adjustments.
    Uses the full V8 scale: -3 (decreased efficacy), -2 (pharmacokinetic),
    -1 (metabolic), 0 (unknown), 1-4 (clinical). May differ from
    `severity` when route adjustments apply.
    """

    severity_name: typing.Optional[InteractionSeverityName] = pydantic.Field(default=None)
    """
    Human-readable severity label
    """

    noise_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    Noise classification for this interaction, if applicable.
    Null for clinically significant interactions. Possible values:
    `"DECREASED_EFFICACY"`, `"PHARMACOKINETIC"`, `"METABOLIC"`.
    """

    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Interaction mechanism or clinical description (English)
    """

    description_ar: typing.Optional[str] = pydantic.Field(default=None)
    """
    Interaction description in Arabic
    """

    clinical_effect: typing.Optional[str] = pydantic.Field(default=None)
    """
    Expected clinical effect of the interaction (English)
    """

    clinical_effect_ar: typing.Optional[str] = pydantic.Field(default=None)
    """
    Expected clinical effect in Arabic
    """

    management: typing.Optional[str] = pydantic.Field(default=None)
    """
    Clinical management strategy (English)
    """

    management_ar: typing.Optional[str] = pydantic.Field(default=None)
    """
    Clinical management strategy in Arabic
    """

    recommendation: typing.Optional[str] = pydantic.Field(default=None)
    """
    Clinical recommendation for managing this interaction (English)
    """

    recommendation_ar: typing.Optional[str] = pydantic.Field(default=None)
    """
    Clinical recommendation in Arabic
    """

    source: typing.Optional[str] = pydantic.Field(default=None)
    """
    Data source
    """

    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
