from __future__ import annotations

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

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

from ..types import UNSET, Unset

if TYPE_CHECKING:
    from ..models.types_invitation import TypesInvitation


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


@_attrs_define
class PkgRoutesClientsBulkContactResult:
    """
    Attributes:
        client_id (str | Unset):
        contact_id (str | Unset): NEW: Include contact ID in results
        error (str | Unset):
        invite (TypesInvitation | Unset):
        success (bool | Unset):
    """

    client_id: str | Unset = UNSET
    contact_id: str | Unset = UNSET
    error: str | Unset = UNSET
    invite: TypesInvitation | Unset = UNSET
    success: bool | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        contact_id = self.contact_id

        error = self.error

        invite: dict[str, Any] | Unset = UNSET
        if not isinstance(self.invite, Unset):
            invite = self.invite.to_dict()

        success = self.success

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client_id is not UNSET:
            field_dict["clientId"] = client_id
        if contact_id is not UNSET:
            field_dict["contactId"] = contact_id
        if error is not UNSET:
            field_dict["error"] = error
        if invite is not UNSET:
            field_dict["invite"] = invite
        if success is not UNSET:
            field_dict["success"] = success

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.types_invitation import TypesInvitation

        d = dict(src_dict)
        client_id = d.pop("clientId", UNSET)

        contact_id = d.pop("contactId", UNSET)

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

        _invite = d.pop("invite", UNSET)
        invite: TypesInvitation | Unset
        if isinstance(_invite, Unset):
            invite = UNSET
        else:
            invite = TypesInvitation.from_dict(_invite)

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

        pkg_routes_clients_bulk_contact_result = cls(
            client_id=client_id,
            contact_id=contact_id,
            error=error,
            invite=invite,
            success=success,
        )

        pkg_routes_clients_bulk_contact_result.additional_properties = d
        return pkg_routes_clients_bulk_contact_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
