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


@_attrs_define
class PkgRoutesClientsCollaboratePermissions:
    """
    Attributes:
        client_portal_access (bool | Unset):
        participant_data_access (bool | Unset):
        read_only (bool | Unset):
    """

    client_portal_access: bool | Unset = UNSET
    participant_data_access: bool | Unset = UNSET
    read_only: bool | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        participant_data_access = self.participant_data_access

        read_only = self.read_only

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client_portal_access is not UNSET:
            field_dict["clientPortalAccess"] = client_portal_access
        if participant_data_access is not UNSET:
            field_dict["participantDataAccess"] = participant_data_access
        if read_only is not UNSET:
            field_dict["readOnly"] = read_only

        return field_dict

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

        participant_data_access = d.pop("participantDataAccess", UNSET)

        read_only = d.pop("readOnly", UNSET)

        pkg_routes_clients_collaborate_permissions = cls(
            client_portal_access=client_portal_access,
            participant_data_access=participant_data_access,
            read_only=read_only,
        )

        pkg_routes_clients_collaborate_permissions.additional_properties = d
        return pkg_routes_clients_collaborate_permissions

    @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
