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="FrontendBasket") @_attrs_define class FrontendBasket: """ Attributes: id (int): event (int): testing (bool): created_by_id (int): The id of the frontendlogin that created the basket. total (str): total_display (str): invoices (list[int]): unikey (str): Return a unique and checksummed-ish key status (str): registrations_count (int): The number of root Selected Nodes linked to this basket. invoices_total (float): Invoices total amount. invoices_total_exceeds_basket_total (bool): Whether the invoices total amount exceeds the basket total. billing_information_id (Union[Unset, int]): The id of the billing information linked to the basket. """ id: int event: int testing: bool created_by_id: int total: str total_display: str invoices: list[int] unikey: str status: str registrations_count: int invoices_total: float invoices_total_exceeds_basket_total: bool billing_information_id: Union[Unset, int] = 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 total = self.total total_display = self.total_display 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 billing_information_id = self.billing_information_id field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "id": id, "event": event, "testing": testing, "created_by_id": created_by_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, } ) if billing_information_id is not UNSET: field_dict["billing_information_id"] = billing_information_id return field_dict def to_multipart(self) -> types.RequestFiles: files: types.RequestFiles = [] files.append(("id", (None, str(self.id).encode(), "text/plain"))) files.append(("event", (None, str(self.event).encode(), "text/plain"))) files.append(("testing", (None, str(self.testing).encode(), "text/plain"))) files.append(("created_by_id", (None, str(self.created_by_id).encode(), "text/plain"))) files.append(("total", (None, str(self.total).encode(), "text/plain"))) files.append(("total_display", (None, str(self.total_display).encode(), "text/plain"))) for invoices_item_element in self.invoices: files.append(("invoices", (None, str(invoices_item_element).encode(), "text/plain"))) files.append(("unikey", (None, str(self.unikey).encode(), "text/plain"))) files.append(("status", (None, str(self.status).encode(), "text/plain"))) files.append(("registrations_count", (None, str(self.registrations_count).encode(), "text/plain"))) files.append(("invoices_total", (None, str(self.invoices_total).encode(), "text/plain"))) files.append( ( "invoices_total_exceeds_basket_total", (None, str(self.invoices_total_exceeds_basket_total).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"))) 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") event = d.pop("event") testing = d.pop("testing") created_by_id = d.pop("created_by_id") total = d.pop("total") total_display = d.pop("total_display") invoices = cast(list[int], d.pop("invoices")) unikey = d.pop("unikey") status = d.pop("status") registrations_count = d.pop("registrations_count") invoices_total = d.pop("invoices_total") invoices_total_exceeds_basket_total = d.pop("invoices_total_exceeds_basket_total") billing_information_id = d.pop("billing_information_id", UNSET) frontend_basket = cls( id=id, event=event, testing=testing, created_by_id=created_by_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, billing_information_id=billing_information_id, ) frontend_basket.additional_properties = d return 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