from collections.abc import Mapping from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from .. import types from ..types import UNSET, Unset T = TypeVar("T", bound="PatchedFrontendBasket") @_attrs_define class PatchedFrontendBasket: """ Attributes: id (Union[Unset, int]): event (Union[Unset, int]): testing (Union[Unset, bool]): created_by_id (Union[Unset, int]): The id of the frontendlogin that created the basket. billing_information_id (Union[Unset, int]): The id of the billing information linked to the basket. total (Union[Unset, str]): total_display (Union[Unset, str]): invoices (Union[Unset, list[int]]): unikey (Union[Unset, str]): Return a unique and checksummed-ish key status (Union[Unset, str]): registrations_count (Union[Unset, int]): The number of root Selected Nodes linked to this basket. invoices_total (Union[Unset, float]): Invoices total amount. invoices_total_exceeds_basket_total (Union[Unset, bool]): Whether the invoices total amount exceeds the basket total. """ id: Union[Unset, int] = UNSET event: Union[Unset, int] = UNSET testing: Union[Unset, bool] = UNSET created_by_id: Union[Unset, int] = UNSET billing_information_id: Union[Unset, int] = UNSET total: Union[Unset, str] = UNSET total_display: Union[Unset, str] = UNSET invoices: Union[Unset, list[int]] = UNSET unikey: Union[Unset, str] = UNSET status: Union[Unset, str] = UNSET registrations_count: Union[Unset, int] = UNSET invoices_total: Union[Unset, float] = UNSET invoices_total_exceeds_basket_total: Union[Unset, bool] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: id = self.id event = self.event testing = self.testing created_by_id = self.created_by_id billing_information_id = self.billing_information_id total = self.total total_display = self.total_display invoices: Union[Unset, list[int]] = UNSET if not isinstance(self.invoices, Unset): invoices = self.invoices unikey = self.unikey status = self.status registrations_count = self.registrations_count invoices_total = self.invoices_total invoices_total_exceeds_basket_total = self.invoices_total_exceeds_basket_total field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update({}) if id is not UNSET: field_dict["id"] = id if event is not UNSET: field_dict["event"] = event if testing is not UNSET: field_dict["testing"] = testing if created_by_id is not UNSET: field_dict["created_by_id"] = created_by_id if billing_information_id is not UNSET: field_dict["billing_information_id"] = billing_information_id if total is not UNSET: field_dict["total"] = total if total_display is not UNSET: field_dict["total_display"] = total_display if invoices is not UNSET: field_dict["invoices"] = invoices if unikey is not UNSET: field_dict["unikey"] = unikey if status is not UNSET: field_dict["status"] = status if registrations_count is not UNSET: field_dict["registrations_count"] = registrations_count if invoices_total is not UNSET: field_dict["invoices_total"] = invoices_total if invoices_total_exceeds_basket_total is not UNSET: field_dict["invoices_total_exceeds_basket_total"] = invoices_total_exceeds_basket_total return field_dict def to_multipart(self) -> types.RequestFiles: files: types.RequestFiles = [] if not isinstance(self.id, Unset): files.append(("id", (None, str(self.id).encode(), "text/plain"))) if not isinstance(self.event, Unset): files.append(("event", (None, str(self.event).encode(), "text/plain"))) if not isinstance(self.testing, Unset): files.append(("testing", (None, str(self.testing).encode(), "text/plain"))) if not isinstance(self.created_by_id, Unset): files.append(("created_by_id", (None, str(self.created_by_id).encode(), "text/plain"))) if not isinstance(self.billing_information_id, Unset): files.append(("billing_information_id", (None, str(self.billing_information_id).encode(), "text/plain"))) if not isinstance(self.total, Unset): files.append(("total", (None, str(self.total).encode(), "text/plain"))) if not isinstance(self.total_display, Unset): files.append(("total_display", (None, str(self.total_display).encode(), "text/plain"))) if not isinstance(self.invoices, Unset): for invoices_item_element in self.invoices: files.append(("invoices", (None, str(invoices_item_element).encode(), "text/plain"))) if not isinstance(self.unikey, Unset): files.append(("unikey", (None, str(self.unikey).encode(), "text/plain"))) if not isinstance(self.status, Unset): files.append(("status", (None, str(self.status).encode(), "text/plain"))) if not isinstance(self.registrations_count, Unset): files.append(("registrations_count", (None, str(self.registrations_count).encode(), "text/plain"))) if not isinstance(self.invoices_total, Unset): files.append(("invoices_total", (None, str(self.invoices_total).encode(), "text/plain"))) if not isinstance(self.invoices_total_exceeds_basket_total, Unset): files.append( ( "invoices_total_exceeds_basket_total", (None, str(self.invoices_total_exceeds_basket_total).encode(), "text/plain"), ) ) for prop_name, prop in self.additional_properties.items(): files.append((prop_name, (None, str(prop).encode(), "text/plain"))) return files @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) id = d.pop("id", UNSET) event = d.pop("event", UNSET) testing = d.pop("testing", UNSET) created_by_id = d.pop("created_by_id", UNSET) billing_information_id = d.pop("billing_information_id", UNSET) total = d.pop("total", UNSET) total_display = d.pop("total_display", UNSET) invoices = cast(list[int], d.pop("invoices", UNSET)) unikey = d.pop("unikey", UNSET) status = d.pop("status", UNSET) registrations_count = d.pop("registrations_count", UNSET) invoices_total = d.pop("invoices_total", UNSET) invoices_total_exceeds_basket_total = d.pop("invoices_total_exceeds_basket_total", UNSET) patched_frontend_basket = cls( id=id, event=event, testing=testing, created_by_id=created_by_id, billing_information_id=billing_information_id, total=total, total_display=total_display, invoices=invoices, unikey=unikey, status=status, registrations_count=registrations_count, invoices_total=invoices_total, invoices_total_exceeds_basket_total=invoices_total_exceeds_basket_total, ) patched_frontend_basket.additional_properties = d return patched_frontend_basket @property def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) def __getitem__(self, key: str) -> Any: return self.additional_properties[key] def __setitem__(self, key: str, value: Any) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: del self.additional_properties[key] def __contains__(self, key: str) -> bool: return key in self.additional_properties