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


@_attrs_define
class PkgRoutesClientsAssociationRequest:
    """
    Attributes:
        contact_type (str | Unset): "Contact" or "External"
        item_id (str | Unset): ID of the company, plan, or deal
        plan_id (str | Unset): Optional plan ID for company associations
        role (str | Unset): Role for the contact
        type_ (str | Unset): "Company", "Plan", "Deal"
    """

    contact_type: str | Unset = UNSET
    item_id: str | Unset = UNSET
    plan_id: str | Unset = UNSET
    role: str | Unset = UNSET
    type_: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        item_id = self.item_id

        plan_id = self.plan_id

        role = self.role

        type_ = self.type_

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if contact_type is not UNSET:
            field_dict["contactType"] = contact_type
        if item_id is not UNSET:
            field_dict["itemId"] = item_id
        if plan_id is not UNSET:
            field_dict["planId"] = plan_id
        if role is not UNSET:
            field_dict["role"] = role
        if type_ is not UNSET:
            field_dict["type"] = type_

        return field_dict

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

        item_id = d.pop("itemId", UNSET)

        plan_id = d.pop("planId", UNSET)

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

        type_ = d.pop("type", UNSET)

        pkg_routes_clients_association_request = cls(
            contact_type=contact_type,
            item_id=item_id,
            plan_id=plan_id,
            role=role,
            type_=type_,
        )

        pkg_routes_clients_association_request.additional_properties = d
        return pkg_routes_clients_association_request

    @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
