# 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 MyUserProtocols(BaseModel):
    my_user_protocols: "MyUserProtocolsMyUserProtocols" = Field(alias="myUserProtocols")


class MyUserProtocolsMyUserProtocols(BaseModel):
    edges: list["MyUserProtocolsMyUserProtocolsEdges"]
    page_info: "MyUserProtocolsMyUserProtocolsPageInfo" = Field(alias="pageInfo")


class MyUserProtocolsMyUserProtocolsEdges(BaseModel):
    cursor: str
    node: "MyUserProtocolsMyUserProtocolsEdgesNode"


class MyUserProtocolsMyUserProtocolsEdgesNode(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["MyUserProtocolsMyUserProtocolsEdgesNodeStepsStructured"] = (
        Field(alias="stepsStructured")
    )
    evidence_refs: list["MyUserProtocolsMyUserProtocolsEdgesNodeEvidenceRefs"] = Field(
        alias="evidenceRefs"
    )
    safety: Optional["MyUserProtocolsMyUserProtocolsEdgesNodeSafety"]
    last_edited_at: Optional[Any] = Field(alias="lastEditedAt")
    created_at: Any = Field(alias="createdAt")
    updated_at: Any = Field(alias="updatedAt")


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


class MyUserProtocolsMyUserProtocolsEdgesNodeStepsStructuredItems(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[
                "MyUserProtocolsMyUserProtocolsEdgesNodeStepsStructuredItemsItemEntityProduct",
                "MyUserProtocolsMyUserProtocolsEdgesNodeStepsStructuredItemsItemEntityCompound",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="itemEntity")


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


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


class MyUserProtocolsMyUserProtocolsEdgesNodeEvidenceRefs(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[
                "MyUserProtocolsMyUserProtocolsEdgesNodeEvidenceRefsEvidenceRefEntityArticle",
                "MyUserProtocolsMyUserProtocolsEdgesNodeEvidenceRefsEvidenceRefEntityCaseStudy",
                "MyUserProtocolsMyUserProtocolsEdgesNodeEvidenceRefsEvidenceRefEntityEpisode",
                "MyUserProtocolsMyUserProtocolsEdgesNodeEvidenceRefsEvidenceRefEntityExternal",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="evidenceRefEntity")


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


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


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


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


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


class MyUserProtocolsMyUserProtocolsPageInfo(BaseModel):
    has_next_page: bool = Field(alias="hasNextPage")
    end_cursor: Optional[str] = Field(alias="endCursor")


MyUserProtocols.model_rebuild()
MyUserProtocolsMyUserProtocols.model_rebuild()
MyUserProtocolsMyUserProtocolsEdges.model_rebuild()
MyUserProtocolsMyUserProtocolsEdgesNode.model_rebuild()
MyUserProtocolsMyUserProtocolsEdgesNodeStepsStructured.model_rebuild()
MyUserProtocolsMyUserProtocolsEdgesNodeStepsStructuredItems.model_rebuild()
MyUserProtocolsMyUserProtocolsEdgesNodeEvidenceRefs.model_rebuild()
