"""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 marshmallow import fields
from sdk import utils
from typing import Optional

class CouponObjectCouponTypeEnum(str, Enum):
    r"""Coupon type"""
    FIXED_AMOUNT = 'fixed_amount'
    PERCENTAGE = 'percentage'

class CouponObjectExpirationEnum(str, Enum):
    r"""Expiration type"""
    NO_EXPIRATION = 'no_expiration'
    TIME_LIMIT = 'time_limit'

class CouponObjectFrequencyEnum(str, Enum):
    r"""Frequency type"""
    ONCE = 'once'
    RECURRING = 'recurring'


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class CouponObject:
    
    code: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('code') }})  
    coupon_type: CouponObjectCouponTypeEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('coupon_type') }})
    r"""Coupon type"""  
    created_at: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('created_at'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso') }})  
    expiration: CouponObjectExpirationEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('expiration') }})
    r"""Expiration type"""  
    frequency: CouponObjectFrequencyEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency') }})
    r"""Frequency type"""  
    lago_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('lago_id') }})  
    name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('name') }})  
    amount_cents: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('amount_cents'), 'exclude': lambda f: f is None }})  
    amount_currency: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('amount_currency'), 'exclude': lambda f: f is None }})  
    expiration_at: Optional[datetime] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('expiration_at'), 'encoder': utils.datetimeisoformat(True), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso'), 'exclude': lambda f: f is None }})  
    frequency_duration: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency_duration'), 'exclude': lambda f: f is None }})  
    limited_plans: Optional[bool] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('limited_plans'), 'exclude': lambda f: f is None }})  
    percentage_rate: Optional[float] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('percentage_rate'), 'exclude': lambda f: f is None }})  
    plan_codes: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('plan_codes'), 'exclude': lambda f: f is None }})  
    reusable: Optional[bool] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('reusable'), 'exclude': lambda f: f is None }})  
    