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

from __future__ import annotations
import dataclasses
from ..shared import amountdiscount as shared_amountdiscount
from ..shared import maximum as shared_maximum
from ..shared import minimum as shared_minimum
from ..shared import percentagediscount as shared_percentagediscount
from ..shared import trialdiscount as shared_trialdiscount
from ..shared import usagediscount as shared_usagediscount
from dataclasses_json import Undefined, dataclass_json
from enum import Enum
from orb import utils
from typing import Optional, Union



@dataclasses.dataclass
class PlanPhaseDiscount:
    pass

class PlanPhaseDurationUnit(str, Enum):
    DAILY = 'daily'
    MONTHLY = 'monthly'
    QUARTERLY = 'quarterly'
    ANNUAL = 'annual'


@dataclass_json(undefined=Undefined.EXCLUDE)

@dataclasses.dataclass
class PlanPhase:
    description: Optional[str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('description') }})
    discount: Optional[Union[shared_percentagediscount.PercentageDiscount, shared_trialdiscount.TrialDiscount, shared_usagediscount.UsageDiscount, shared_amountdiscount.AmountDiscount]] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('discount') }})
    duration: Optional[int] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('duration') }})
    r"""How many terms of length `duration_unit` this phase is active for. If null, this phase is evergreen and active indefinitely"""
    duration_unit: Optional[PlanPhaseDurationUnit] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('duration_unit') }})
    id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id') }})
    maximum: Optional[shared_maximum.Maximum] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('maximum') }})
    maximum_amount: Optional[str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('maximum_amount') }})
    minimum: Optional[shared_minimum.Minimum] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('minimum') }})
    minimum_amount: Optional[str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('minimum_amount') }})
    name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('name') }})
    order: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('order') }})
    r"""Determines the ordering of the phase in a plan's lifecycle. 1 = first phase."""
    

