"""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

class CancelSubscriptionParamsCancelOption(str, Enum):
    r"""Determines the timing of subscription cancellation"""
    END_OF_SUBSCRIPTION_TERM = 'end_of_subscription_term'
    IMMEDIATE = 'immediate'
    REQUESTED_DATE = 'requested_date'


@dataclass_json(undefined=Undefined.EXCLUDE)

@dataclasses.dataclass
class CancelSubscriptionParams:
    cancel_option: CancelSubscriptionParamsCancelOption = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('cancel_option') }})
    r"""Determines the timing of subscription cancellation"""
    cancellation_date: Optional[datetime] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('cancellation_date'), 'encoder': utils.datetimeisoformat(True), 'decoder': dateutil.parser.isoparse }})
    r"""The date that the cancellation should take effect. This parameter can only be passed if the `cancel_option` is `requested_date`."""
    

