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


@_attrs_define
class PkgRoutesIamUserShortUser:
    """
    Attributes:
        field_id (str | Unset):
        deleted_at (str | Unset):
        email (str | Unset):
        name (str | Unset):
        title (str | Unset):
    """

    field_id: str | Unset = UNSET
    deleted_at: str | Unset = UNSET
    email: str | Unset = UNSET
    name: str | Unset = UNSET
    title: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        deleted_at = self.deleted_at

        email = self.email

        name = self.name

        title = self.title

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if field_id is not UNSET:
            field_dict["_id"] = field_id
        if deleted_at is not UNSET:
            field_dict["deleted_at"] = deleted_at
        if email is not UNSET:
            field_dict["email"] = email
        if name is not UNSET:
            field_dict["name"] = name
        if title is not UNSET:
            field_dict["title"] = title

        return field_dict

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

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

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

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

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

        pkg_routes_iam_user_short_user = cls(
            field_id=field_id,
            deleted_at=deleted_at,
            email=email,
            name=name,
            title=title,
        )

        pkg_routes_iam_user_short_user.additional_properties = d
        return pkg_routes_iam_user_short_user

    @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
