# Generated by ariadne-codegen
# Source: hubsrht/services/hub/

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

from pydantic import Field

from .base_model import BaseModel
from .enums import RepoType, Visibility


class GetResourceProjects(BaseModel):
    resource: Optional[
        Annotated[
            Union[
                "GetResourceProjectsResourceProjectResource",
                "GetResourceProjectsResourceSourceRepo",
            ],
            Field(discriminator="typename__"),
        ]
    ]


class GetResourceProjectsResourceProjectResource(BaseModel):
    typename__: Literal["MailingList", "ProjectResource", "Tracker"] = Field(
        alias="__typename"
    )
    name: str
    description: Optional[str]
    owner: "GetResourceProjectsResourceProjectResourceOwner"
    projects: "GetResourceProjectsResourceProjectResourceProjects"


class GetResourceProjectsResourceProjectResourceOwner(BaseModel):
    typename__: Literal["Entity", "User"] = Field(alias="__typename")
    canonical_name: str = Field(alias="canonicalName")


class GetResourceProjectsResourceProjectResourceProjects(BaseModel):
    results: list["GetResourceProjectsResourceProjectResourceProjectsResults"]
    cursor: Optional[Any]


class GetResourceProjectsResourceProjectResourceProjectsResults(BaseModel):
    name: str
    description: Optional[str]
    visibility: Visibility
    owner: "GetResourceProjectsResourceProjectResourceProjectsResultsOwner"


class GetResourceProjectsResourceProjectResourceProjectsResultsOwner(BaseModel):
    typename__: Literal["Entity", "User"] = Field(alias="__typename")
    canonical_name: str = Field(alias="canonicalName")


class GetResourceProjectsResourceSourceRepo(BaseModel):
    typename__: Literal["SourceRepo"] = Field(alias="__typename")
    name: str
    description: Optional[str]
    owner: "GetResourceProjectsResourceSourceRepoOwner"
    repo_type: RepoType = Field(alias="repoType")
    projects: "GetResourceProjectsResourceSourceRepoProjects"


class GetResourceProjectsResourceSourceRepoOwner(BaseModel):
    typename__: Literal["Entity", "User"] = Field(alias="__typename")
    canonical_name: str = Field(alias="canonicalName")


class GetResourceProjectsResourceSourceRepoProjects(BaseModel):
    results: list["GetResourceProjectsResourceSourceRepoProjectsResults"]
    cursor: Optional[Any]


class GetResourceProjectsResourceSourceRepoProjectsResults(BaseModel):
    name: str
    description: Optional[str]
    visibility: Visibility
    owner: "GetResourceProjectsResourceSourceRepoProjectsResultsOwner"


class GetResourceProjectsResourceSourceRepoProjectsResultsOwner(BaseModel):
    typename__: Literal["Entity", "User"] = Field(alias="__typename")
    canonical_name: str = Field(alias="canonicalName")


GetResourceProjects.model_rebuild()
GetResourceProjectsResourceProjectResource.model_rebuild()
GetResourceProjectsResourceProjectResourceProjects.model_rebuild()
GetResourceProjectsResourceProjectResourceProjectsResults.model_rebuild()
GetResourceProjectsResourceSourceRepo.model_rebuild()
GetResourceProjectsResourceSourceRepoProjects.model_rebuild()
GetResourceProjectsResourceSourceRepoProjectsResults.model_rebuild()
