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

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .subscription_action_type import SubscriptionActionType
from .phase import Phase
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class SubscriptionAction(UncheckedBaseModel):
    """
    Represents an action as a pending change to a subscription.
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of an action scoped to a subscription.
    """

    type: typing.Optional[SubscriptionActionType] = pydantic.Field(default=None)
    """
    The type of the action.
    See [SubscriptionActionType](#type-subscriptionactiontype) for possible values
    """

    effective_date: typing.Optional[str] = pydantic.Field(default=None)
    """
    The `YYYY-MM-DD`-formatted date when the action occurs on the subscription.
    """

    monthly_billing_anchor_date: typing.Optional[int] = pydantic.Field(default=None)
    """
    The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action.
    """

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

    new_plan_variation_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action.
    """

    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
