# 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 SavedEntityType, SaveSource


class SavedEntities(BaseModel):
    saved_entities: "SavedEntitiesSavedEntities" = Field(alias="savedEntities")


class SavedEntitiesSavedEntities(BaseModel):
    edges: list["SavedEntitiesSavedEntitiesEdges"]
    page_info: "SavedEntitiesSavedEntitiesPageInfo" = Field(alias="pageInfo")


class SavedEntitiesSavedEntitiesEdges(BaseModel):
    cursor: str
    node: "SavedEntitiesSavedEntitiesEdgesNode"


class SavedEntitiesSavedEntitiesEdgesNode(BaseModel):
    id: str
    user_id: str = Field(alias="userId")
    target_type: SavedEntityType = Field(alias="targetType")
    target_id: str = Field(alias="targetId")
    note: Optional[str]
    tags: list[str]
    pinned: bool
    source: Optional[SaveSource]
    created_at: Any = Field(alias="createdAt")
    updated_at: Any = Field(alias="updatedAt")
    target: Optional[
        Annotated[
            Union[
                "SavedEntitiesSavedEntitiesEdgesNodeTargetProduct",
                "SavedEntitiesSavedEntitiesEdgesNodeTargetCompound",
                "SavedEntitiesSavedEntitiesEdgesNodeTargetCaseStudy",
                "SavedEntitiesSavedEntitiesEdgesNodeTargetProtocol",
                "SavedEntitiesSavedEntitiesEdgesNodeTargetPerson",
                "SavedEntitiesSavedEntitiesEdgesNodeTargetBusiness",
                "SavedEntitiesSavedEntitiesEdgesNodeTargetEpisode",
                "SavedEntitiesSavedEntitiesEdgesNodeTargetArticle",
            ],
            Field(discriminator="typename__"),
        ]
    ]


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


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


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


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


class SavedEntitiesSavedEntitiesEdgesNodeTargetPerson(BaseModel):
    typename__: Literal["Person"] = Field(alias="__typename")
    id: str
    name: str
    role: Optional[str]


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


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


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


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


SavedEntities.model_rebuild()
SavedEntitiesSavedEntities.model_rebuild()
SavedEntitiesSavedEntitiesEdges.model_rebuild()
SavedEntitiesSavedEntitiesEdgesNode.model_rebuild()
