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

from __future__ import annotations
import dataclasses
import dateutil.parser
from dataclasses_json import Undefined, dataclass_json
from datetime import datetime
from enum import Enum
from orb import utils
from typing import Optional, Union

class UsageDiscountIntervalDiscountType(str, Enum):
    USAGE = 'usage'



@dataclasses.dataclass
class UsageDiscountIntervalUsageDiscount:
    pass


@dataclass_json(undefined=Undefined.EXCLUDE)

@dataclasses.dataclass
class UsageDiscountInterval:
    applies_to_price_ids: list[str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('applies_to_price_ids') }})
    r"""The price ids that this discount interval applies to."""
    applies_to_price_interval_ids: list[str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('applies_to_price_interval_ids') }})
    r"""The price interval ids that this discount interval applies to."""
    discount_type: UsageDiscountIntervalDiscountType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('discount_type') }})
    end_date: Optional[datetime] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_date'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse }})
    r"""The end date of the discount interval."""
    start_date: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('start_date'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse }})
    r"""The start date of the discount interval."""
    usage_discount: Union[float, str] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('usage_discount') }})
    r"""Only available if discount_type is `usage`. Number of usage units that this discount is for"""
    

