# 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 UpdateProtocol(BaseModel):
    update_protocol: Optional["UpdateProtocolUpdateProtocol"] = Field(
        alias="updateProtocol"
    )


class UpdateProtocolUpdateProtocol(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["UpdateProtocolUpdateProtocolStepsStructured"]] = (
        Field(alias="stepsStructured")
    )
    evidence_refs: list["UpdateProtocolUpdateProtocolEvidenceRefs"] = Field(
        alias="evidenceRefs"
    )
    safety: Optional["UpdateProtocolUpdateProtocolSafety"]
    products: list["UpdateProtocolUpdateProtocolProducts"]
    compounds: list["UpdateProtocolUpdateProtocolCompounds"]


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


class UpdateProtocolUpdateProtocolStepsStructuredItems(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[
                "UpdateProtocolUpdateProtocolStepsStructuredItemsItemEntityProduct",
                "UpdateProtocolUpdateProtocolStepsStructuredItemsItemEntityCompound",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="itemEntity")


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


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


class UpdateProtocolUpdateProtocolEvidenceRefs(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[
                "UpdateProtocolUpdateProtocolEvidenceRefsEvidenceRefEntityArticle",
                "UpdateProtocolUpdateProtocolEvidenceRefsEvidenceRefEntityCaseStudy",
                "UpdateProtocolUpdateProtocolEvidenceRefsEvidenceRefEntityEpisode",
                "UpdateProtocolUpdateProtocolEvidenceRefsEvidenceRefEntityExternal",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="evidenceRefEntity")


class UpdateProtocolUpdateProtocolEvidenceRefsEvidenceRefEntityArticle(BaseModel):
    typename__: Literal["Article"] = Field(alias="__typename")
    id: str
    title: str
    article_summary: str = Field(alias="articleSummary")


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


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


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


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


class UpdateProtocolUpdateProtocolProducts(BaseModel):
    id: str
    name: str


class UpdateProtocolUpdateProtocolCompounds(BaseModel):
    id: str
    name: str


UpdateProtocol.model_rebuild()
UpdateProtocolUpdateProtocol.model_rebuild()
UpdateProtocolUpdateProtocolStepsStructured.model_rebuild()
UpdateProtocolUpdateProtocolStepsStructuredItems.model_rebuild()
UpdateProtocolUpdateProtocolEvidenceRefs.model_rebuild()
