2023-07-07 18:03:18 -07:00
|
|
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
|
|
|
|
|
|
|
import attr
|
|
|
|
|
|
|
|
from ..types import UNSET, Unset
|
|
|
|
|
2023-09-29 15:51:03 -07:00
|
|
|
FH = TypeVar("FH", bound="Coupon")
|
2023-07-07 18:03:18 -07:00
|
|
|
|
|
|
|
@attr.s(auto_attribs=True)
|
|
|
|
class Coupon:
|
2023-09-29 16:05:40 -07:00
|
|
|
""" The resource representing a Coupon. """ # noqa: E501
|
|
|
|
amount_off: Union[Unset, float] = UNSET
|
|
|
|
deleted: Union[Unset, bool] = False
|
|
|
|
id: Union[Unset, str] = UNSET
|
|
|
|
percent_off: Union[Unset, float] = UNSET
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
|
|
amount_off = self.amount_off
|
|
|
|
deleted = self.deleted
|
|
|
|
id = self.id
|
|
|
|
percent_off = self.percent_off
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
field_dict: Dict[str, Any] = {}
|
|
|
|
field_dict.update(self.additional_properties)
|
|
|
|
field_dict.update({})
|
|
|
|
if amount_off is not UNSET:
|
|
|
|
field_dict['amount_off'] = amount_off
|
|
|
|
if deleted is not UNSET:
|
|
|
|
field_dict['deleted'] = deleted
|
|
|
|
if id is not UNSET:
|
|
|
|
field_dict['id'] = id
|
|
|
|
if percent_off is not UNSET:
|
|
|
|
field_dict['percent_off'] = percent_off
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
return field_dict
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
@classmethod
|
|
|
|
def from_dict(cls: Type[FH], src_dict: Dict[str, Any]) -> FH:
|
|
|
|
d = src_dict.copy()
|
|
|
|
amount_off = d.pop("amount_off", UNSET)
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
deleted = d.pop("deleted", UNSET)
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
id = d.pop("id", UNSET)
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
percent_off = d.pop("percent_off", UNSET)
|
2023-07-07 18:03:18 -07:00
|
|
|
|
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
coupon = cls(
|
|
|
|
amount_off= amount_off,
|
|
|
|
deleted= deleted,
|
|
|
|
id= id,
|
|
|
|
percent_off= percent_off,
|
|
|
|
)
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
coupon.additional_properties = d
|
|
|
|
return coupon
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
@property
|
|
|
|
def additional_keys(self) -> List[str]:
|
|
|
|
return list(self.additional_properties.keys())
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def __getitem__(self, key: str) -> Any:
|
|
|
|
return self.additional_properties[key]
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
|
|
self.additional_properties[key] = value
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def __delitem__(self, key: str) -> None:
|
|
|
|
del self.additional_properties[key]
|
2023-07-07 18:03:18 -07:00
|
|
|
|
2023-09-29 16:05:40 -07:00
|
|
|
def __contains__(self, key: str) -> bool:
|
|
|
|
return key in self.additional_properties
|