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

from datetime import datetime
from typing import Annotated, Optional

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

from .base_model import BaseModel
from .enums import Currency, PaymentIntentStatus, PaymentInterval, SubscriptionStatus
from .fragments import BillingAddress, Invoice


class GetBillingDashboard(BaseModel):
    me: "GetBillingDashboardMe"


class GetBillingDashboardMe(BaseModel):
    subscription: Optional["GetBillingDashboardMeSubscription"]
    methods: list["GetBillingDashboardMeMethods"]
    default_method: Optional["GetBillingDashboardMeDefaultMethod"] = Field(
        alias="defaultMethod"
    )
    address: Optional["GetBillingDashboardMeAddress"]
    invoices: "GetBillingDashboardMeInvoices"


class GetBillingDashboardMeSubscription(BaseModel):
    status: SubscriptionStatus
    updated: Annotated[datetime, BeforeValidator(gql_time)]
    interval: PaymentInterval
    autorenew: bool
    currency: Currency
    subtotal: int
    total: int
    product: "GetBillingDashboardMeSubscriptionProduct"
    payment: "GetBillingDashboardMeSubscriptionPayment"


class GetBillingDashboardMeSubscriptionProduct(BaseModel):
    retired: bool


class GetBillingDashboardMeSubscriptionPayment(BaseModel):
    status: PaymentIntentStatus
    error: Optional[str]


class GetBillingDashboardMeMethods(BaseModel):
    id: int
    name: str
    created: Annotated[datetime, BeforeValidator(gql_time)]
    expires: Optional[Annotated[datetime, BeforeValidator(gql_time)]]


class GetBillingDashboardMeDefaultMethod(BaseModel):
    id: int


class GetBillingDashboardMeAddress(BillingAddress):
    pass


class GetBillingDashboardMeInvoices(BaseModel):
    results: list["GetBillingDashboardMeInvoicesResults"]


class GetBillingDashboardMeInvoicesResults(Invoice):
    pass


GetBillingDashboard.model_rebuild()
GetBillingDashboardMe.model_rebuild()
GetBillingDashboardMeSubscription.model_rebuild()
GetBillingDashboardMeInvoices.model_rebuild()
