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

from __future__ import annotations
from ..core.unchecked_base_model import UncheckedBaseModel
from .catalog_category import CatalogCategory
from .catalog_object_category import CatalogObjectCategory
import pydantic
import typing
from .subscription_phase import SubscriptionPhase
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.pydantic_utilities import update_forward_refs


class CatalogSubscriptionPlan(UncheckedBaseModel):
    """
    Describes a subscription plan. A subscription plan represents what you want to sell in a subscription model, and includes references to each of the associated subscription plan variations.
    For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations).
    """

    name: str = pydantic.Field()
    """
    The name of the plan.
    """

    phases: typing.Optional[typing.List[SubscriptionPhase]] = pydantic.Field(default=None)
    """
    A list of SubscriptionPhase containing the [SubscriptionPhase](entity:SubscriptionPhase) for this plan.
    This field it required. Not including this field will throw a REQUIRED_FIELD_MISSING error
    """

    subscription_plan_variations: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
    """
    The list of subscription plan variations available for this product
    """

    eligible_item_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    The list of IDs of `CatalogItems` that are eligible for subscription by this SubscriptionPlan's variations.
    """

    eligible_category_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    The list of IDs of `CatalogCategory` that are eligible for subscription by this SubscriptionPlan's variations.
    """

    all_items: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If true, all items in the merchant's catalog are subscribable by this SubscriptionPlan.
    """

    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 .catalog_item import CatalogItem  # noqa: E402
from .catalog_item_option import CatalogItemOption  # noqa: E402
from .catalog_modifier_list import CatalogModifierList  # noqa: E402
from .catalog_object_item import CatalogObjectItem  # noqa: E402
from .catalog_object_item_option import CatalogObjectItemOption  # noqa: E402
from .catalog_object_modifier_list import CatalogObjectModifierList  # noqa: E402
from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan  # noqa: E402
from .catalog_object import CatalogObject  # noqa: E402

update_forward_refs(CatalogSubscriptionPlan)
