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

from .payment_schedule_base import PaymentScheduleBase
import pydantic
import typing
from .payment_month_repeat_type import PaymentMonthRepeatType
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class PaymentMonthSchedule(PaymentScheduleBase):
    """
    Examples
    --------
    import datetime

    from mercoa.invoice_types import PaymentMonthSchedule

    PaymentMonthSchedule(
        day_offset=10,
        offset_type="start",
        ends=datetime.datetime.fromisoformat(
            "2021-01-01 00:00:00+00:00",
        ),
    )
    """

    day_offset: int = pydantic.Field(alias="dayOffset")
    """
    Offset from the start or end of the month to repeat on (0-30). Defaults to 0.
    """

    offset_type: typing.Optional[PaymentMonthRepeatType] = pydantic.Field(alias="offsetType", default=None)
    """
    Type of offset. If start, will offset from the start of the month (so 10 with an offset of start will be on the 10th of the month). If end, will offset from the end of the month (so 10 with an offset of end will be the 20th).
    """

    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
