# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...core.serialization import FieldMetadata
from ...types.bill_data import BillData
from ...types.entrypointfield import Entrypointfield
from ...types.payment_detail import PaymentDetail
from ...types.payor_data_request import PayorDataRequest
from ...types.schedule_detail import ScheduleDetail
from ...types.source import Source
from ...types.subdomain import Subdomain
from .request_schedule_payment_method import RequestSchedulePaymentMethod
from .set_pause import SetPause


class SubscriptionRequestBody(UniversalBaseModel):
    customer_data: typing_extensions.Annotated[
        typing.Optional[PayorDataRequest], FieldMetadata(alias="customerData")
    ] = pydantic.Field(default=None)
    """
    Object describing the customer/payor.
    """

    entry_point: typing_extensions.Annotated[typing.Optional[Entrypointfield], FieldMetadata(alias="entryPoint")] = None
    invoice_data: typing_extensions.Annotated[typing.Optional[BillData], FieldMetadata(alias="invoiceData")] = (
        pydantic.Field(default=None)
    )
    """
    Object describing an Invoice linked to the subscription.
    """

    payment_details: typing_extensions.Annotated[
        typing.Optional[PaymentDetail], FieldMetadata(alias="paymentDetails")
    ] = pydantic.Field(default=None)
    """
    Object describing details of the payment. To skip the payment, set the `totalAmount` to 0. Payments will be paused until the amount is updated to a non-zero value. When `totalAmount` is set to 0, the `serviceFee` must also be set to 0.
    """

    payment_method: typing_extensions.Annotated[
        typing.Optional[RequestSchedulePaymentMethod], FieldMetadata(alias="paymentMethod")
    ] = pydantic.Field(default=None)
    """
    Information about the payment method for the transaction. Required and recommended fields for each payment method type are described in each schema below.
    """

    schedule_details: typing_extensions.Annotated[
        typing.Optional[ScheduleDetail], FieldMetadata(alias="scheduleDetails")
    ] = pydantic.Field(default=None)
    """
    Object describing the schedule for subscription.
    """

    set_pause: typing_extensions.Annotated[typing.Optional[SetPause], FieldMetadata(alias="setPause")] = None
    source: typing.Optional[Source] = None
    subdomain: typing.Optional[Subdomain] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
