from __future__ import annotations

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

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

from ..types import UNSET, Unset

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


@_attrs_define
class PkgRoutesClientsCollaborateCollaborateRequest:
    """
    Attributes:
        company (str | Unset):
        contact (str | Unset):
        cp_access (bool | Unset):
        email (str | Unset):
        folders (list[str] | Unset):
        name (str | Unset):
        preferred_name (str | Unset):
        read_only (bool | Unset):
        share_participant_data (bool | Unset):
    """

    company: str | Unset = UNSET
    contact: str | Unset = UNSET
    cp_access: bool | Unset = UNSET
    email: str | Unset = UNSET
    folders: list[str] | Unset = UNSET
    name: str | Unset = UNSET
    preferred_name: str | Unset = UNSET
    read_only: bool | Unset = UNSET
    share_participant_data: bool | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        contact = self.contact

        cp_access = self.cp_access

        email = self.email

        folders: list[str] | Unset = UNSET
        if not isinstance(self.folders, Unset):
            folders = self.folders

        name = self.name

        preferred_name = self.preferred_name

        read_only = self.read_only

        share_participant_data = self.share_participant_data

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if company is not UNSET:
            field_dict["company"] = company
        if contact is not UNSET:
            field_dict["contact"] = contact
        if cp_access is not UNSET:
            field_dict["cp_access"] = cp_access
        if email is not UNSET:
            field_dict["email"] = email
        if folders is not UNSET:
            field_dict["folders"] = folders
        if name is not UNSET:
            field_dict["name"] = name
        if preferred_name is not UNSET:
            field_dict["preferred_name"] = preferred_name
        if read_only is not UNSET:
            field_dict["read_only"] = read_only
        if share_participant_data is not UNSET:
            field_dict["share_participant_data"] = share_participant_data

        return field_dict

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

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

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

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

        folders = cast(list[str], d.pop("folders", UNSET))

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

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

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

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

        pkg_routes_clients_collaborate_collaborate_request = cls(
            company=company,
            contact=contact,
            cp_access=cp_access,
            email=email,
            folders=folders,
            name=name,
            preferred_name=preferred_name,
            read_only=read_only,
            share_participant_data=share_participant_data,
        )

        pkg_routes_clients_collaborate_collaborate_request.additional_properties = d
        return pkg_routes_clients_collaborate_collaborate_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
