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

from typing import Annotated, Literal, Optional, Union

from pydantic import Field

from .base_model import BaseModel
from .enums import Currency, PaymentInterval, PaymentStatus
from .fragments import BillingAddress


class OrderProduct(BaseModel):
    intent: Optional[
        Annotated[
            Union[
                "OrderProductIntentPaymentIntent",
                "OrderProductIntentStripePaymentIntent",
            ],
            Field(discriminator="typename__"),
        ]
    ]


class OrderProductIntentPaymentIntent(BaseModel):
    typename__: Literal["PaymentIntent"] = Field(alias="__typename")
    subscription: "OrderProductIntentPaymentIntentSubscription"
    billing_address: "OrderProductIntentPaymentIntentBillingAddress" = Field(
        alias="billingAddress"
    )
    idempotency_key: str = Field(alias="idempotencyKey")
    tax_rate: Optional[float] = Field(alias="taxRate")
    tax_due: int = Field(alias="taxDue")
    total_due: int = Field(alias="totalDue")


class OrderProductIntentPaymentIntentSubscription(BaseModel):
    user: "OrderProductIntentPaymentIntentSubscriptionUser"
    currency: Currency
    interval: PaymentInterval
    product: "OrderProductIntentPaymentIntentSubscriptionProduct"
    price: "OrderProductIntentPaymentIntentSubscriptionPrice"
    subtotal: int


class OrderProductIntentPaymentIntentSubscriptionUser(BaseModel):
    payment_status: PaymentStatus = Field(alias="paymentStatus")


class OrderProductIntentPaymentIntentSubscriptionProduct(BaseModel):
    id: int
    name: str


class OrderProductIntentPaymentIntentSubscriptionPrice(BaseModel):
    currency: Currency
    amount: int


class OrderProductIntentPaymentIntentBillingAddress(BillingAddress):
    pass


class OrderProductIntentStripePaymentIntent(BaseModel):
    typename__: Literal["StripePaymentIntent"] = Field(alias="__typename")
    subscription: "OrderProductIntentStripePaymentIntentSubscription"
    billing_address: "OrderProductIntentStripePaymentIntentBillingAddress" = Field(
        alias="billingAddress"
    )
    idempotency_key: str = Field(alias="idempotencyKey")
    tax_rate: Optional[float] = Field(alias="taxRate")
    tax_due: int = Field(alias="taxDue")
    total_due: int = Field(alias="totalDue")
    public_key: Optional[str] = Field(alias="publicKey")
    client_secret: Optional[str] = Field(alias="clientSecret")


class OrderProductIntentStripePaymentIntentSubscription(BaseModel):
    user: "OrderProductIntentStripePaymentIntentSubscriptionUser"
    currency: Currency
    interval: PaymentInterval
    product: "OrderProductIntentStripePaymentIntentSubscriptionProduct"
    price: "OrderProductIntentStripePaymentIntentSubscriptionPrice"
    subtotal: int


class OrderProductIntentStripePaymentIntentSubscriptionUser(BaseModel):
    payment_status: PaymentStatus = Field(alias="paymentStatus")


class OrderProductIntentStripePaymentIntentSubscriptionProduct(BaseModel):
    id: int
    name: str


class OrderProductIntentStripePaymentIntentSubscriptionPrice(BaseModel):
    currency: Currency
    amount: int


class OrderProductIntentStripePaymentIntentBillingAddress(BillingAddress):
    pass


OrderProduct.model_rebuild()
OrderProductIntentPaymentIntent.model_rebuild()
OrderProductIntentPaymentIntentSubscription.model_rebuild()
OrderProductIntentStripePaymentIntent.model_rebuild()
OrderProductIntentStripePaymentIntentSubscription.model_rebuild()
