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

from ..types import UNSET, Unset

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


@_attrs_define
class MixedBagOrderDTO:
    """
    Attributes:
        contact_name (str): Contact name for paperwork. Example: Max Mustermann.
        product (str): Product code. Example: GMM.
        service_level (str): The service level of the order: PRIORITY Example: PRIORITY.
        items_count (int): Number of items in bag. Minimum 1.
        items_weight_in_kilogram (float): The weight in kilogram of the bag. Example: 50.
        total_count_receptacles (int): Number of airway bills. Example: 3.
        order_id (int | Unset):
        customer_ekp (str | Unset):
        awb_id (str | Unset): Either the AWB is generated, or sent by the customer. Example: 9980000000203.
        format_ (str | Unset): The format of package. Everytime MIXED. Example: MIXED.
        telephone_number (str | Unset): Telephone number for paperwork. Mandatory for sales channel EXPRESS. Example:
            +491234567890.
        job_reference (str | Unset): Job reference for the whole shipment. Example: Internal ID 03/14.
        auth_user (str | Unset):
    """

    contact_name: str
    product: str
    service_level: str
    items_count: int
    items_weight_in_kilogram: float
    total_count_receptacles: int
    order_id: int | Unset = UNSET
    customer_ekp: str | Unset = UNSET
    awb_id: str | Unset = UNSET
    format_: str | Unset = UNSET
    telephone_number: str | Unset = UNSET
    job_reference: str | Unset = UNSET
    auth_user: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        contact_name = self.contact_name

        product = self.product

        service_level = self.service_level

        items_count = self.items_count

        items_weight_in_kilogram = self.items_weight_in_kilogram

        total_count_receptacles = self.total_count_receptacles

        order_id = self.order_id

        customer_ekp = self.customer_ekp

        awb_id = self.awb_id

        format_ = self.format_

        telephone_number = self.telephone_number

        job_reference = self.job_reference

        auth_user = self.auth_user

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update(
            {
                "contactName": contact_name,
                "product": product,
                "serviceLevel": service_level,
                "itemsCount": items_count,
                "itemsWeightInKilogram": items_weight_in_kilogram,
                "totalCountReceptacles": total_count_receptacles,
            }
        )
        if order_id is not UNSET:
            field_dict["orderId"] = order_id
        if customer_ekp is not UNSET:
            field_dict["customerEkp"] = customer_ekp
        if awb_id is not UNSET:
            field_dict["awbId"] = awb_id
        if format_ is not UNSET:
            field_dict["format"] = format_
        if telephone_number is not UNSET:
            field_dict["telephoneNumber"] = telephone_number
        if job_reference is not UNSET:
            field_dict["jobReference"] = job_reference
        if auth_user is not UNSET:
            field_dict["authUser"] = auth_user

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        d = dict(src_dict)
        contact_name = d.pop("contactName")

        product = d.pop("product")

        service_level = d.pop("serviceLevel")

        items_count = d.pop("itemsCount")

        items_weight_in_kilogram = d.pop("itemsWeightInKilogram")

        total_count_receptacles = d.pop("totalCountReceptacles")

        order_id = d.pop("orderId", UNSET)

        customer_ekp = d.pop("customerEkp", UNSET)

        awb_id = d.pop("awbId", UNSET)

        format_ = d.pop("format", UNSET)

        telephone_number = d.pop("telephoneNumber", UNSET)

        job_reference = d.pop("jobReference", UNSET)

        auth_user = d.pop("authUser", UNSET)

        mixed_bag_order_dto = cls(
            contact_name=contact_name,
            product=product,
            service_level=service_level,
            items_count=items_count,
            items_weight_in_kilogram=items_weight_in_kilogram,
            total_count_receptacles=total_count_receptacles,
            order_id=order_id,
            customer_ekp=customer_ekp,
            awb_id=awb_id,
            format_=format_,
            telephone_number=telephone_number,
            job_reference=job_reference,
            auth_user=auth_user,
        )

        mixed_bag_order_dto.additional_properties = d
        return mixed_bag_order_dto

    @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
