# Generated by ariadne-codegen
# Source: metasrht/graphql/

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 Currency, PaymentInterval
from .fragments import Invoice


class GetUserAdmin(BaseModel):
    personal_access_tokens: list["GetUserAdminPersonalAccessTokens"] = Field(
        alias="personalAccessTokens"
    )
    oauth_clients: list["GetUserAdminOauthClients"] = Field(alias="oauthClients")
    oauth_grants: list["GetUserAdminOauthGrants"] = Field(alias="oauthGrants")
    user: "GetUserAdminUser"


class GetUserAdminPersonalAccessTokens(BaseModel):
    id: int
    comment: Optional[str]
    issued: Annotated[datetime, BeforeValidator(gql_time)]
    expires: Annotated[datetime, BeforeValidator(gql_time)]


class GetUserAdminOauthClients(BaseModel):
    id: int
    uuid: str
    name: str
    url: Optional[str]


class GetUserAdminOauthGrants(BaseModel):
    id: int
    issued: Annotated[datetime, BeforeValidator(gql_time)]
    expires: Annotated[datetime, BeforeValidator(gql_time)]
    token_hash: str = Field(alias="tokenHash")
    client: "GetUserAdminOauthGrantsClient"


class GetUserAdminOauthGrantsClient(BaseModel):
    name: str
    url: Optional[str]
    owner: "GetUserAdminOauthGrantsClientOwner"


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


class GetUserAdminUser(BaseModel):
    subscription: Optional["GetUserAdminUserSubscription"]
    invoices: "GetUserAdminUserInvoices"


class GetUserAdminUserSubscription(BaseModel):
    interval: PaymentInterval
    subtotal: int
    currency: Currency


class GetUserAdminUserInvoices(BaseModel):
    results: list["GetUserAdminUserInvoicesResults"]


class GetUserAdminUserInvoicesResults(Invoice):
    pass


GetUserAdmin.model_rebuild()
GetUserAdminOauthGrants.model_rebuild()
GetUserAdminOauthGrantsClient.model_rebuild()
GetUserAdminUser.model_rebuild()
GetUserAdminUserInvoices.model_rebuild()
