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


@_attrs_define
class LegacytypesCollaborator:
    """
    Attributes:
        accepted_at (str | Unset):
        cp_access (bool | Unset):
        declined_at (str | Unset):
        participant_data_access_approved_at (str | Unset):
        participant_data_access_approved_by (str | Unset):
        participant_data_access_requested_at (str | Unset): Special sharing permissions for participant data access
        read_only (bool | Unset):
        shared_at (str | Unset):
        shared_by_user (str | Unset):
        shared_with_email (str | Unset):
        shared_with_team (str | Unset):
        shared_with_user (str | Unset):
    """

    accepted_at: str | Unset = UNSET
    cp_access: bool | Unset = UNSET
    declined_at: str | Unset = UNSET
    participant_data_access_approved_at: str | Unset = UNSET
    participant_data_access_approved_by: str | Unset = UNSET
    participant_data_access_requested_at: str | Unset = UNSET
    read_only: bool | Unset = UNSET
    shared_at: str | Unset = UNSET
    shared_by_user: str | Unset = UNSET
    shared_with_email: str | Unset = UNSET
    shared_with_team: str | Unset = UNSET
    shared_with_user: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        cp_access = self.cp_access

        declined_at = self.declined_at

        participant_data_access_approved_at = self.participant_data_access_approved_at

        participant_data_access_approved_by = self.participant_data_access_approved_by

        participant_data_access_requested_at = self.participant_data_access_requested_at

        read_only = self.read_only

        shared_at = self.shared_at

        shared_by_user = self.shared_by_user

        shared_with_email = self.shared_with_email

        shared_with_team = self.shared_with_team

        shared_with_user = self.shared_with_user

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if accepted_at is not UNSET:
            field_dict["accepted_at"] = accepted_at
        if cp_access is not UNSET:
            field_dict["cp_access"] = cp_access
        if declined_at is not UNSET:
            field_dict["declined_at"] = declined_at
        if participant_data_access_approved_at is not UNSET:
            field_dict["participant_data_access_approved_at"] = participant_data_access_approved_at
        if participant_data_access_approved_by is not UNSET:
            field_dict["participant_data_access_approved_by"] = participant_data_access_approved_by
        if participant_data_access_requested_at is not UNSET:
            field_dict["participant_data_access_requested_at"] = participant_data_access_requested_at
        if read_only is not UNSET:
            field_dict["read_only"] = read_only
        if shared_at is not UNSET:
            field_dict["shared_at"] = shared_at
        if shared_by_user is not UNSET:
            field_dict["shared_by_user"] = shared_by_user
        if shared_with_email is not UNSET:
            field_dict["shared_with_email"] = shared_with_email
        if shared_with_team is not UNSET:
            field_dict["shared_with_team"] = shared_with_team
        if shared_with_user is not UNSET:
            field_dict["shared_with_user"] = shared_with_user

        return field_dict

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

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

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

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

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

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

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

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

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

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

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

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

        legacytypes_collaborator = cls(
            accepted_at=accepted_at,
            cp_access=cp_access,
            declined_at=declined_at,
            participant_data_access_approved_at=participant_data_access_approved_at,
            participant_data_access_approved_by=participant_data_access_approved_by,
            participant_data_access_requested_at=participant_data_access_requested_at,
            read_only=read_only,
            shared_at=shared_at,
            shared_by_user=shared_by_user,
            shared_with_email=shared_with_email,
            shared_with_team=shared_with_team,
            shared_with_user=shared_with_user,
        )

        legacytypes_collaborator.additional_properties = d
        return legacytypes_collaborator

    @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
