# Generated by ariadne-codegen
# Source: api/graph/schema.graphqls

from typing import Annotated, Optional

from iso3166 import Country
from pydantic import Field, PlainSerializer

from metasrht.countries import serialize

from .base_model import BaseModel, Upload
from .enums import Currency, PaymentInterval, WebhookEvent


class UserInput(BaseModel):
    """Omit these fields to leave them unchanged, or set them to null to clear
    their value."""

    url: Optional[str] = None
    location: Optional[str] = None
    bio: Optional[str] = None
    avatar: Optional[Upload] = None
    pronouns: Optional[str] = None
    email: Optional[str] = None
    "Note: changing the user's email address will not take effect immediately;\nthe user is sent an email to confirm the change first."


class ProfileWebhookInput(BaseModel):
    url: str
    events: list[WebhookEvent]
    query: str


class BillingAddressInput(BaseModel):
    """All fields are optional. If a field is omitted, it is unchanged. If a field is
    null, it is set to null."""

    full_name: Optional[str] = Field(alias="fullName", default=None)
    business_name: Optional[str] = Field(alias="businessName", default=None)
    address_1: Optional[str] = Field(alias="address1", default=None)
    address_2: Optional[str] = Field(alias="address2", default=None)
    city: Optional[str] = None
    region: Optional[str] = None
    postcode: Optional[str] = None
    country: Optional[Annotated[Country, PlainSerializer(serialize)]] = None
    "ISO 3166 two-letter country code"
    vat: Optional[str] = None
    "Value-added tax number (EU)"


class UpdateBillingSubscriptionInput(BaseModel):
    """For changing the active paid subscription's parameters. Changes apply from the
    start of the next payment term (i.e. from User.paymentDue)."""

    product_id: int = Field(alias="productID")
    interval: PaymentInterval


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