"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""

from __future__ import annotations
import dataclasses
from ..shared import billingcyclealignment as shared_billingcyclealignment
from ..shared import changeoption as shared_changeoption
from ..shared import discount as shared_discount
from ..shared import overridebpsprice as shared_overridebpsprice
from ..shared import overridebulkbpsprice as shared_overridebulkbpsprice
from ..shared import overridebulkprice as shared_overridebulkprice
from ..shared import overridefivetranexampleprice as shared_overridefivetranexampleprice
from ..shared import overridematrixprice as shared_overridematrixprice
from ..shared import overridepackageprice as shared_overridepackageprice
from ..shared import overridepackagewithallocationprice as shared_overridepackagewithallocationprice
from ..shared import overridetestratingfunctionprice as shared_overridetestratingfunctionprice
from ..shared import overridethresholdtotalamountprice as shared_overridethresholdtotalamountprice
from ..shared import overridetieredbpsprice as shared_overridetieredbpsprice
from ..shared import overridetieredpackageprice as shared_overridetieredpackageprice
from ..shared import overridetieredprice as shared_overridetieredprice
from ..shared import overridetieredwithminimumprice as shared_overridetieredwithminimumprice
from ..shared import overrideunitprice as shared_overrideunitprice
from ..shared import phaseoverride as shared_phaseoverride
from dataclasses_json import Undefined, dataclass_json
from orb import utils
from typing import Optional, Union



@dataclasses.dataclass
class SubscriptionPlanChangeCreditsOverageRate:
    pass



@dataclasses.dataclass
class SubscriptionPlanChangePriceOverrides:
    pass


@dataclass_json(undefined=Undefined.EXCLUDE)

@dataclasses.dataclass
class SubscriptionPlanChange:
    change_option: shared_changeoption.ChangeOption = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('change_option') }})
    align_billing_with_plan_change_date: Optional[bool] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('align_billing_with_plan_change_date') }})
    r"""[DEPRECATED] Use billing_cycle_alignment instead. Reset billing periods to be aligned with the plan change’s effective date."""
    billing_cycle_alignment: Optional[shared_billingcyclealignment.BillingCycleAlignment] = dataclasses.field(default=shared_billingcyclealignment.BillingCycleAlignment.UNCHANGED, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('billing_cycle_alignment') }})
    r"""Reset billing periods to be aligned with the plan change’s effective date or start of the month. Defaults to `unchanged` which keeps subscription's existing billing cycle alignment."""
    change_date: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('change_date') }})
    r"""The date that the plan change should take effect. This parameter can only be passed if the `change_option` is `requested_date`."""
    coupon_redemption_code: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('coupon_redemption_code') }})
    r"""Redemption code to be used for this subscription. If the coupon cannot be found by its redemption code, or cannot be redeemed, an error response will be returned and the plan change will not be scheduled."""
    credits_overage_rate: Optional[Union[float, str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('credits_overage_rate') }})
    discount: Optional[shared_discount.Discount] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('discount') }})
    r"""The subscription's override discount for the plan."""
    external_plan_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('external_plan_id') }})
    r"""The external_plan_id of the plan that the given subscription should be switched to. Note that either this property or `plan_id` must be specified."""
    initial_phase_order: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('initial_phase_order') }})
    r"""The phase of the plan to start with"""
    invoicing_threshold: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('invoicing_threshold') }})
    r"""When this subscription's accrued usage reaches this threshold, an invoice will be issued for the subscription. If not specified, invoices will only be issued at the end of the billing period."""
    maximum_amount: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('maximum_amount') }})
    r"""The subscription's override maximum amount for the plan."""
    minimum_amount: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('minimum_amount') }})
    r"""The subscription's override minimum amount for the plan."""
    per_credit_overage_amount: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('per_credit_overage_amount') }})
    phase_overrides: Optional[list[shared_phaseoverride.PhaseOverride]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('phase_overrides') }})
    plan_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('plan_id') }})
    r"""The plan that the given subscription should be switched to. Note that either this property or `external_plan_id` must be specified."""
    price_overrides: Optional[list[Union[shared_overrideunitprice.OverrideUnitPrice, shared_overridepackageprice.OverridePackagePrice, shared_overridematrixprice.OverrideMatrixPrice, shared_overridetieredprice.OverrideTieredPrice, shared_overridetieredbpsprice.OverrideTieredBpsPrice, shared_overridebpsprice.OverrideBpsPrice, shared_overridebulkbpsprice.OverrideBulkBpsPrice, shared_overridebulkprice.OverrideBulkPrice, shared_overridetestratingfunctionprice.OverrideTestRatingFunctionPrice, shared_overridefivetranexampleprice.OverrideFivetranExamplePrice, shared_overridethresholdtotalamountprice.OverrideThresholdTotalAmountPrice, shared_overridetieredpackageprice.OverrideTieredPackagePrice, shared_overridetieredwithminimumprice.OverrideTieredWithMinimumPrice, shared_overridepackagewithallocationprice.OverridePackageWithAllocationPrice]]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('price_overrides') }})
    r"""Optionally provide a list of overrides for prices on the plan"""
    

