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="BagItemContentDto")


@_attrs_define
class BagItemContentDto:
    """
    Attributes:
        amount (str | Unset):
        description (str | Unset):
        value (str | Unset):
        hs_code (str | Unset):
        net_weight (str | Unset):
        origin_country (str | Unset):
    """

    amount: str | Unset = UNSET
    description: str | Unset = UNSET
    value: str | Unset = UNSET
    hs_code: str | Unset = UNSET
    net_weight: str | Unset = UNSET
    origin_country: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        description = self.description

        value = self.value

        hs_code = self.hs_code

        net_weight = self.net_weight

        origin_country = self.origin_country

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if amount is not UNSET:
            field_dict["amount"] = amount
        if description is not UNSET:
            field_dict["description"] = description
        if value is not UNSET:
            field_dict["value"] = value
        if hs_code is not UNSET:
            field_dict["hsCode"] = hs_code
        if net_weight is not UNSET:
            field_dict["netWeight"] = net_weight
        if origin_country is not UNSET:
            field_dict["originCountry"] = origin_country

        return field_dict

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

        description = d.pop("description", UNSET)

        value = d.pop("value", UNSET)

        hs_code = d.pop("hsCode", UNSET)

        net_weight = d.pop("netWeight", UNSET)

        origin_country = d.pop("originCountry", UNSET)

        bag_item_content_dto = cls(
            amount=amount,
            description=description,
            value=value,
            hs_code=hs_code,
            net_weight=net_weight,
            origin_country=origin_country,
        )

        bag_item_content_dto.additional_properties = d
        return bag_item_content_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
