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

from typing import Annotated, Any, Literal, Optional, Union

from pydantic import Field

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


class UpdateUserProtocol(BaseModel):
    update_user_protocol: Optional["UpdateUserProtocolUpdateUserProtocol"] = Field(
        alias="updateUserProtocol"
    )


class UpdateUserProtocolUpdateUserProtocol(BaseModel):
    id: str
    user_id: str = Field(alias="userId")
    title: str
    goal_type: Optional[UserGoalType] = Field(alias="goalType")
    status: UserProtocolStatus
    source_protocol_id: Optional[str] = Field(alias="sourceProtocolId")
    steps_structured: list["UpdateUserProtocolUpdateUserProtocolStepsStructured"] = (
        Field(alias="stepsStructured")
    )
    evidence_refs: list["UpdateUserProtocolUpdateUserProtocolEvidenceRefs"] = Field(
        alias="evidenceRefs"
    )
    safety: Optional["UpdateUserProtocolUpdateUserProtocolSafety"]
    last_edited_at: Optional[Any] = Field(alias="lastEditedAt")
    created_at: Any = Field(alias="createdAt")
    updated_at: Any = Field(alias="updatedAt")


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


class UpdateUserProtocolUpdateUserProtocolStepsStructuredItems(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[
                "UpdateUserProtocolUpdateUserProtocolStepsStructuredItemsItemEntityProduct",
                "UpdateUserProtocolUpdateUserProtocolStepsStructuredItemsItemEntityCompound",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="itemEntity")


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


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


class UpdateUserProtocolUpdateUserProtocolEvidenceRefs(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[
                "UpdateUserProtocolUpdateUserProtocolEvidenceRefsEvidenceRefEntityArticle",
                "UpdateUserProtocolUpdateUserProtocolEvidenceRefsEvidenceRefEntityCaseStudy",
                "UpdateUserProtocolUpdateUserProtocolEvidenceRefsEvidenceRefEntityEpisode",
                "UpdateUserProtocolUpdateUserProtocolEvidenceRefsEvidenceRefEntityExternal",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="evidenceRefEntity")


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


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


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


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


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


UpdateUserProtocol.model_rebuild()
UpdateUserProtocolUpdateUserProtocol.model_rebuild()
UpdateUserProtocolUpdateUserProtocolStepsStructured.model_rebuild()
UpdateUserProtocolUpdateUserProtocolStepsStructuredItems.model_rebuild()
UpdateUserProtocolUpdateUserProtocolEvidenceRefs.model_rebuild()
