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

from ..core.unchecked_base_model import UncheckedBaseModel
import pydantic
from .subscription_event_subscription_event_type import SubscriptionEventSubscriptionEventType
import typing
from .subscription_event_info import SubscriptionEventInfo
from .phase import Phase
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class SubscriptionEvent(UncheckedBaseModel):
    """
    Describes changes to a subscription and the subscription status.
    """

    id: str = pydantic.Field()
    """
    The ID of the subscription event.
    """

    subscription_event_type: SubscriptionEventSubscriptionEventType = pydantic.Field()
    """
    Type of the subscription event.
    See [SubscriptionEventSubscriptionEventType](#type-subscriptioneventsubscriptioneventtype) for possible values
    """

    effective_date: str = pydantic.Field()
    """
    The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred.
    """

    monthly_billing_anchor_date: typing.Optional[int] = pydantic.Field(default=None)
    """
    The day-of-the-month the billing anchor date was changed to, if applicable.
    """

    info: typing.Optional[SubscriptionEventInfo] = pydantic.Field(default=None)
    """
    Additional information about the subscription event.
    """

    phases: typing.Optional[typing.List[Phase]] = pydantic.Field(default=None)
    """
    A list of Phases, to pass phase-specific information used in the swap.
    """

    plan_variation_id: str = pydantic.Field()
    """
    The ID of the subscription plan variation associated with the subscription.
    """

    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
