# Generated by ariadne-codegen
# Source: ../../src/graphql/operations

from typing import Annotated, Literal, Optional, Union

from pydantic import Field

from .base_model import BaseModel
from .enums import (
    EvidenceRefType,
    ProtocolCategory,
    ProtocolStepItemType,
    ProtocolTimeOfDay,
)


class Protocol(BaseModel):
    protocol: Optional["ProtocolProtocol"]


class ProtocolProtocol(BaseModel):
    id: str
    name: str
    description: Optional[str]
    categories: list[ProtocolCategory]
    goals: list[str]
    steps: list[str]
    cautions: list[str]
    aliases: list[str]
    source_url: Optional[str] = Field(alias="sourceUrl")
    steps_structured: Optional[list["ProtocolProtocolStepsStructured"]] = Field(
        alias="stepsStructured"
    )
    evidence_refs: list["ProtocolProtocolEvidenceRefs"] = Field(alias="evidenceRefs")
    safety: Optional["ProtocolProtocolSafety"]
    products: list["ProtocolProtocolProducts"]
    compounds: list["ProtocolProtocolCompounds"]


class ProtocolProtocolStepsStructured(BaseModel):
    label: Optional[str]
    time_of_day: Optional[ProtocolTimeOfDay] = Field(alias="timeOfDay")
    items: list["ProtocolProtocolStepsStructuredItems"]


class ProtocolProtocolStepsStructuredItems(BaseModel):
    type: ProtocolStepItemType
    ref_id: Optional[str] = Field(alias="refId")
    name_override: Optional[str] = Field(alias="nameOverride")
    dosage: Optional[str]
    timing: Optional[str]
    notes: Optional[str]
    item_entity: Optional[
        Annotated[
            Union[
                "ProtocolProtocolStepsStructuredItemsItemEntityProduct",
                "ProtocolProtocolStepsStructuredItemsItemEntityCompound",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="itemEntity")


class ProtocolProtocolStepsStructuredItemsItemEntityProduct(BaseModel):
    typename__: Literal["Product"] = Field(alias="__typename")
    id: str
    name: str
    description: Optional[str]


class ProtocolProtocolStepsStructuredItemsItemEntityCompound(BaseModel):
    typename__: Literal["Compound"] = Field(alias="__typename")
    id: str
    name: str
    description: Optional[str]


class ProtocolProtocolEvidenceRefs(BaseModel):
    type: EvidenceRefType
    ref_id: Optional[str] = Field(alias="refId")
    label: Optional[str]
    url: Optional[str]
    episode_id: Optional[str] = Field(alias="episodeId")
    timestamps: list[int]
    notes: Optional[str]
    evidence_ref_entity: Optional[
        Annotated[
            Union[
                "ProtocolProtocolEvidenceRefsEvidenceRefEntityArticle",
                "ProtocolProtocolEvidenceRefsEvidenceRefEntityCaseStudy",
                "ProtocolProtocolEvidenceRefsEvidenceRefEntityEpisode",
                "ProtocolProtocolEvidenceRefsEvidenceRefEntityExternal",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="evidenceRefEntity")


class ProtocolProtocolEvidenceRefsEvidenceRefEntityArticle(BaseModel):
    typename__: Literal["Article"] = Field(alias="__typename")
    id: str
    title: str
    summary: str


class ProtocolProtocolEvidenceRefsEvidenceRefEntityCaseStudy(BaseModel):
    typename__: Literal["CaseStudy"] = Field(alias="__typename")
    id: str
    title: str
    summary: str


class ProtocolProtocolEvidenceRefsEvidenceRefEntityEpisode(BaseModel):
    typename__: Literal["Episode"] = Field(alias="__typename")
    id: str
    episode_title: Optional[str] = Field(alias="episodeTitle")
    channel_name: str = Field(alias="channelName")


class ProtocolProtocolEvidenceRefsEvidenceRefEntityExternal(BaseModel):
    typename__: Literal["External"] = Field(alias="__typename")
    url: Optional[str]
    label: Optional[str]


class ProtocolProtocolSafety(BaseModel):
    warnings: list[str]
    contraindications: list[str]
    interactions: list[str]
    notes: Optional[str]


class ProtocolProtocolProducts(BaseModel):
    id: str
    name: str
    description: Optional[str]


class ProtocolProtocolCompounds(BaseModel):
    id: str
    name: str
    description: Optional[str]


Protocol.model_rebuild()
ProtocolProtocol.model_rebuild()
ProtocolProtocolStepsStructured.model_rebuild()
ProtocolProtocolStepsStructuredItems.model_rebuild()
ProtocolProtocolEvidenceRefs.model_rebuild()
