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

from datetime import datetime
from typing import Annotated, Literal, Optional

from pydantic import BeforeValidator, Field
from srht.graphql import gql_time

from .base_model import BaseModel
from .enums import Visibility


class TrackerDetails(BaseModel):
    id: int
    rid: str
    name: str
    description: Optional[str]
    visibility: Visibility
    updated: Annotated[datetime, BeforeValidator(gql_time)]
    default_acl: "TrackerDetailsDefaultAcl" = Field(alias="defaultACL")
    owner: "TrackerDetailsOwner"


class TrackerDetailsDefaultAcl(BaseModel):
    browse: bool


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


TrackerDetails.model_rebuild()
