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

from __future__ import annotations
from ...core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .payment_schedule_end_condition import PaymentScheduleEndCondition
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from .day_of_week import DayOfWeek
from .payment_month_repeat_type import PaymentMonthRepeatType


class PaymentSchedule_OneTime(UniversalBaseModel):
    """
    Examples
    --------
    from mercoa.invoice_types import PaymentSchedule_OneTime

    PaymentSchedule_OneTime()
    """

    type: typing.Literal["oneTime"] = "oneTime"
    repeat_every: typing.Optional[int] = pydantic.Field(alias="repeatEvery", default=None)
    ends: typing.Optional[PaymentScheduleEndCondition] = 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


class PaymentSchedule_Daily(UniversalBaseModel):
    """
    Examples
    --------
    from mercoa.invoice_types import PaymentSchedule_OneTime

    PaymentSchedule_OneTime()
    """

    type: typing.Literal["daily"] = "daily"
    repeat_every: typing.Optional[int] = pydantic.Field(alias="repeatEvery", default=None)
    ends: typing.Optional[PaymentScheduleEndCondition] = 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


class PaymentSchedule_Weekly(UniversalBaseModel):
    """
    Examples
    --------
    from mercoa.invoice_types import PaymentSchedule_OneTime

    PaymentSchedule_OneTime()
    """

    type: typing.Literal["weekly"] = "weekly"
    repeat_on: typing.List[DayOfWeek] = pydantic.Field(alias="repeatOn")
    repeat_every: typing.Optional[int] = pydantic.Field(alias="repeatEvery", default=None)
    ends: typing.Optional[PaymentScheduleEndCondition] = 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


class PaymentSchedule_Monthly(UniversalBaseModel):
    """
    Examples
    --------
    from mercoa.invoice_types import PaymentSchedule_OneTime

    PaymentSchedule_OneTime()
    """

    type: typing.Literal["monthly"] = "monthly"
    day_offset: int = pydantic.Field(alias="dayOffset")
    offset_type: typing.Optional[PaymentMonthRepeatType] = pydantic.Field(alias="offsetType", default=None)
    repeat_every: typing.Optional[int] = pydantic.Field(alias="repeatEvery", default=None)
    ends: typing.Optional[PaymentScheduleEndCondition] = 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


class PaymentSchedule_Yearly(UniversalBaseModel):
    """
    Examples
    --------
    from mercoa.invoice_types import PaymentSchedule_OneTime

    PaymentSchedule_OneTime()
    """

    type: typing.Literal["yearly"] = "yearly"
    repeat_on_day: int = pydantic.Field(alias="repeatOnDay")
    repeat_on_month: int = pydantic.Field(alias="repeatOnMonth")
    repeat_every: typing.Optional[int] = pydantic.Field(alias="repeatEvery", default=None)
    ends: typing.Optional[PaymentScheduleEndCondition] = 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


"""
from mercoa.invoice_types import PaymentSchedule_OneTime

PaymentSchedule_OneTime()
"""
PaymentSchedule = typing.Union[
    PaymentSchedule_OneTime,
    PaymentSchedule_Daily,
    PaymentSchedule_Weekly,
    PaymentSchedule_Monthly,
    PaymentSchedule_Yearly,
]
