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


@_attrs_define
class PkgRoutesInboxStatsResult:
    """
    Attributes:
        outbox (int | Unset):
        unread (int | Unset):
        unread_clients (int | Unset):
        unread_important (int | Unset):
        unread_internal (int | Unset):
    """

    outbox: int | Unset = UNSET
    unread: int | Unset = UNSET
    unread_clients: int | Unset = UNSET
    unread_important: int | Unset = UNSET
    unread_internal: int | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        unread = self.unread

        unread_clients = self.unread_clients

        unread_important = self.unread_important

        unread_internal = self.unread_internal

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if outbox is not UNSET:
            field_dict["outbox"] = outbox
        if unread is not UNSET:
            field_dict["unread"] = unread
        if unread_clients is not UNSET:
            field_dict["unread_clients"] = unread_clients
        if unread_important is not UNSET:
            field_dict["unread_important"] = unread_important
        if unread_internal is not UNSET:
            field_dict["unread_internal"] = unread_internal

        return field_dict

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

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

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

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

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

        pkg_routes_inbox_stats_result = cls(
            outbox=outbox,
            unread=unread,
            unread_clients=unread_clients,
            unread_important=unread_important,
            unread_internal=unread_internal,
        )

        pkg_routes_inbox_stats_result.additional_properties = d
        return pkg_routes_inbox_stats_result

    @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
