from __future__ import annotations

from collections.abc import Mapping
from typing import Any, TypeVar

from attrs import define as _attrs_define
from attrs import field as _attrs_field

T = TypeVar("T", bound="OrderResponse")


@_attrs_define
class OrderResponse:
    """
    Example:
        {'customerEkp': '9012345678', 'orderId': 1234, 'orderStatus': 'FINALIZE', 'shipments': {'awb': 9980000123456,
            'items': {'id': 123456, 'barcode': 'RX12345678DE', 'product': 'GMP', 'serviceLevel': 'PRIORITY', 'custRef':
            'REF-2361890-AB', 'recipient': 'Alfred J. Quack', 'recipientPhone': '+4935120681234', 'addressLine1':
            'Mustergasse 12', 'addressLine2': 'Hinterhaus', 'addressLine3': '1. Etage', 'city': 'Dresden', 'state':
            'Sachsen', 'postalCode': '01432', 'destinationCountry': 'DE', 'shipmentGrossWeight': 1500, 'senderTaxID': 'IOSS
            number', 'importerTaxId': 'IOSS number', 'returnItemWanted': False, 'contents': []}}}

    """

    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        d = dict(src_dict)
        order_response = cls()

        order_response.additional_properties = d
        return order_response

    @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
