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


@_attrs_define
class LegacytypesAssignee:
    """
    Attributes:
        deal (str | Unset):
        hide_from_client (bool | Unset):
        plan (str | Unset): Is the assignee specifically tied to a plan or deal?
        role (str | Unset):
        shared (bool | Unset): For returning
        user (str | Unset):
    """

    deal: str | Unset = UNSET
    hide_from_client: bool | Unset = UNSET
    plan: str | Unset = UNSET
    role: str | Unset = UNSET
    shared: bool | Unset = UNSET
    user: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        hide_from_client = self.hide_from_client

        plan = self.plan

        role = self.role

        shared = self.shared

        user = self.user

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if deal is not UNSET:
            field_dict["deal"] = deal
        if hide_from_client is not UNSET:
            field_dict["hide_from_client"] = hide_from_client
        if plan is not UNSET:
            field_dict["plan"] = plan
        if role is not UNSET:
            field_dict["role"] = role
        if shared is not UNSET:
            field_dict["shared"] = shared
        if user is not UNSET:
            field_dict["user"] = user

        return field_dict

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

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

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

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

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

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

        legacytypes_assignee = cls(
            deal=deal,
            hide_from_client=hide_from_client,
            plan=plan,
            role=role,
            shared=shared,
            user=user,
        )

        legacytypes_assignee.additional_properties = d
        return legacytypes_assignee

    @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
