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


@_attrs_define
class TypesComment:
    """
    Attributes:
        field_id (str | Unset):
        client (str | Unset):
        content (str | Unset):
        deleted_at (str | Unset):
        likes (list[str] | Unset):
        on_id (str | Unset):
        on_type (str | Unset):
        reply_to (str | Unset):
        team (str | Unset):
        timestamp (str | Unset):
        user (str | Unset):
    """

    field_id: str | Unset = UNSET
    client: str | Unset = UNSET
    content: str | Unset = UNSET
    deleted_at: str | Unset = UNSET
    likes: list[str] | Unset = UNSET
    on_id: str | Unset = UNSET
    on_type: str | Unset = UNSET
    reply_to: str | Unset = UNSET
    team: str | Unset = UNSET
    timestamp: str | Unset = UNSET
    user: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        client = self.client

        content = self.content

        deleted_at = self.deleted_at

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

        on_id = self.on_id

        on_type = self.on_type

        reply_to = self.reply_to

        team = self.team

        timestamp = self.timestamp

        user = self.user

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if field_id is not UNSET:
            field_dict["_id"] = field_id
        if client is not UNSET:
            field_dict["client"] = client
        if content is not UNSET:
            field_dict["content"] = content
        if deleted_at is not UNSET:
            field_dict["deleted_at"] = deleted_at
        if likes is not UNSET:
            field_dict["likes"] = likes
        if on_id is not UNSET:
            field_dict["on_id"] = on_id
        if on_type is not UNSET:
            field_dict["on_type"] = on_type
        if reply_to is not UNSET:
            field_dict["reply_to"] = reply_to
        if team is not UNSET:
            field_dict["team"] = team
        if timestamp is not UNSET:
            field_dict["timestamp"] = timestamp
        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)
        field_id = d.pop("_id", UNSET)

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

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

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

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

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

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

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

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

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

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

        types_comment = cls(
            field_id=field_id,
            client=client,
            content=content,
            deleted_at=deleted_at,
            likes=likes,
            on_id=on_id,
            on_type=on_type,
            reply_to=reply_to,
            team=team,
            timestamp=timestamp,
            user=user,
        )

        types_comment.additional_properties = d
        return types_comment

    @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
