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


@_attrs_define
class PkgRoutesContactsContactActivityResponsePagination:
    """
    Attributes:
        limit (int | Unset):
        page (int | Unset):
        pages (int | Unset):
        total (int | Unset):
    """

    limit: int | Unset = UNSET
    page: int | Unset = UNSET
    pages: int | Unset = UNSET
    total: int | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        page = self.page

        pages = self.pages

        total = self.total

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if limit is not UNSET:
            field_dict["limit"] = limit
        if page is not UNSET:
            field_dict["page"] = page
        if pages is not UNSET:
            field_dict["pages"] = pages
        if total is not UNSET:
            field_dict["total"] = total

        return field_dict

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

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

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

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

        pkg_routes_contacts_contact_activity_response_pagination = cls(
            limit=limit,
            page=page,
            pages=pages,
            total=total,
        )

        pkg_routes_contacts_contact_activity_response_pagination.additional_properties = d
        return pkg_routes_contacts_contact_activity_response_pagination

    @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
