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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .plan_selection import PlanSelection
from .update_credit_bundle_request_body import UpdateCreditBundleRequestBody
from .update_pay_in_advance_request_body import UpdatePayInAdvanceRequestBody


class ManagePlanRequest(UniversalBaseModel):
    add_on_selections: typing.List[PlanSelection]
    base_plan_id: typing.Optional[str] = None
    base_plan_price_id: typing.Optional[str] = None
    cancel_immediately: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If false, subscription cancels at period end. Only applies when removing all plans. Defaults to true.
    """

    company_id: str
    coupon_external_id: typing.Optional[str] = None
    credit_bundles: typing.List[UpdateCreditBundleRequestBody]
    pay_in_advance_entitlements: typing.List[UpdatePayInAdvanceRequestBody]
    payment_method_external_id: typing.Optional[str] = None
    promo_code: typing.Optional[str] = None
    prorate: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If true and cancel_immediately is true, issue prorated credit. Only applies when removing all plans. Defaults to true.
    """

    trial_end: typing.Optional[dt.datetime] = 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
