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


@_attrs_define
class PkgRoutesWebhooksGMailWebhookMessage:
    """
    Attributes:
        data (str | Unset):
        message_id (str | Unset):
        publish_time (str | Unset):
    """

    data: str | Unset = UNSET
    message_id: str | Unset = UNSET
    publish_time: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        message_id = self.message_id

        publish_time = self.publish_time

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if data is not UNSET:
            field_dict["data"] = data
        if message_id is not UNSET:
            field_dict["messageId"] = message_id
        if publish_time is not UNSET:
            field_dict["publishTime"] = publish_time

        return field_dict

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

        message_id = d.pop("messageId", UNSET)

        publish_time = d.pop("publishTime", UNSET)

        pkg_routes_webhooks_g_mail_webhook_message = cls(
            data=data,
            message_id=message_id,
            publish_time=publish_time,
        )

        pkg_routes_webhooks_g_mail_webhook_message.additional_properties = d
        return pkg_routes_webhooks_g_mail_webhook_message

    @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
