from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field if TYPE_CHECKING: from ..models.event_statistics_invoices_refunded import EventStatisticsInvoicesRefunded from ..models.event_statistics_invoices_refunded_value import EventStatisticsInvoicesRefundedValue from ..models.event_statistics_invoices_resolved import EventStatisticsInvoicesResolved from ..models.event_statistics_invoices_resolved_value import EventStatisticsInvoicesResolvedValue T = TypeVar("T", bound="EventStatistics") @_attrs_define class EventStatistics: """Serializer for the action event-statistics used to display the dashboard of an event Attributes: invoices_resolved (EventStatisticsInvoicesResolved): associate the number of invoices resolved (INCLUDING the refunded ones) per timestamps invoices_resolved_value (EventStatisticsInvoicesResolvedValue): associate the value of the total amount from the invoices resolved (INCLUDING the refunded ones) per timestamps invoices_refunded (EventStatisticsInvoicesRefunded): associate the number of invoices refunded (only those FULLY refunded) per timestamps invoices_refunded_value (EventStatisticsInvoicesRefundedValue): associate the value of the total amount from invoices refunded (= invoices with negative amounts) per timestamps invoices_in_progress (int): the count of invoices that are still in progress """ invoices_resolved: "EventStatisticsInvoicesResolved" invoices_resolved_value: "EventStatisticsInvoicesResolvedValue" invoices_refunded: "EventStatisticsInvoicesRefunded" invoices_refunded_value: "EventStatisticsInvoicesRefundedValue" invoices_in_progress: int additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: invoices_resolved = self.invoices_resolved.to_dict() invoices_resolved_value = self.invoices_resolved_value.to_dict() invoices_refunded = self.invoices_refunded.to_dict() invoices_refunded_value = self.invoices_refunded_value.to_dict() invoices_in_progress = self.invoices_in_progress field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "invoices_resolved": invoices_resolved, "invoices_resolved_value": invoices_resolved_value, "invoices_refunded": invoices_refunded, "invoices_refunded_value": invoices_refunded_value, "invoices_in_progress": invoices_in_progress, } ) return field_dict @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: from ..models.event_statistics_invoices_refunded import EventStatisticsInvoicesRefunded from ..models.event_statistics_invoices_refunded_value import EventStatisticsInvoicesRefundedValue from ..models.event_statistics_invoices_resolved import EventStatisticsInvoicesResolved from ..models.event_statistics_invoices_resolved_value import EventStatisticsInvoicesResolvedValue d = dict(src_dict) invoices_resolved = EventStatisticsInvoicesResolved.from_dict(d.pop("invoices_resolved")) invoices_resolved_value = EventStatisticsInvoicesResolvedValue.from_dict(d.pop("invoices_resolved_value")) invoices_refunded = EventStatisticsInvoicesRefunded.from_dict(d.pop("invoices_refunded")) invoices_refunded_value = EventStatisticsInvoicesRefundedValue.from_dict(d.pop("invoices_refunded_value")) invoices_in_progress = d.pop("invoices_in_progress") event_statistics = cls( invoices_resolved=invoices_resolved, invoices_resolved_value=invoices_resolved_value, invoices_refunded=invoices_refunded, invoices_refunded_value=invoices_refunded_value, invoices_in_progress=invoices_in_progress, ) event_statistics.additional_properties = d return event_statistics @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