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


@_attrs_define
class TypesEmailConfig:
    """
    Attributes:
        access_token (str | Unset):
        address (str | Unset):
        auto_reply (bool | Unset):
        auto_reply_body (str | Unset):
        auto_reply_from (str | Unset):
        auto_reply_subject (str | Unset):
        auto_reply_to (str | Unset):
        connected_at (str | Unset):
        error (str | Unset):
        errored_at (str | Unset):
        last_sync (str | Unset):
        private (bool | Unset):
        provider (str | Unset):
        refresh_token (str | Unset):
        status (str | Unset):
        sync_mutex (bool | Unset):
    """

    access_token: str | Unset = UNSET
    address: str | Unset = UNSET
    auto_reply: bool | Unset = UNSET
    auto_reply_body: str | Unset = UNSET
    auto_reply_from: str | Unset = UNSET
    auto_reply_subject: str | Unset = UNSET
    auto_reply_to: str | Unset = UNSET
    connected_at: str | Unset = UNSET
    error: str | Unset = UNSET
    errored_at: str | Unset = UNSET
    last_sync: str | Unset = UNSET
    private: bool | Unset = UNSET
    provider: str | Unset = UNSET
    refresh_token: str | Unset = UNSET
    status: str | Unset = UNSET
    sync_mutex: bool | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        address = self.address

        auto_reply = self.auto_reply

        auto_reply_body = self.auto_reply_body

        auto_reply_from = self.auto_reply_from

        auto_reply_subject = self.auto_reply_subject

        auto_reply_to = self.auto_reply_to

        connected_at = self.connected_at

        error = self.error

        errored_at = self.errored_at

        last_sync = self.last_sync

        private = self.private

        provider = self.provider

        refresh_token = self.refresh_token

        status = self.status

        sync_mutex = self.sync_mutex

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if access_token is not UNSET:
            field_dict["access_token"] = access_token
        if address is not UNSET:
            field_dict["address"] = address
        if auto_reply is not UNSET:
            field_dict["auto_reply"] = auto_reply
        if auto_reply_body is not UNSET:
            field_dict["auto_reply_body"] = auto_reply_body
        if auto_reply_from is not UNSET:
            field_dict["auto_reply_from"] = auto_reply_from
        if auto_reply_subject is not UNSET:
            field_dict["auto_reply_subject"] = auto_reply_subject
        if auto_reply_to is not UNSET:
            field_dict["auto_reply_to"] = auto_reply_to
        if connected_at is not UNSET:
            field_dict["connected_at"] = connected_at
        if error is not UNSET:
            field_dict["error"] = error
        if errored_at is not UNSET:
            field_dict["errored_at"] = errored_at
        if last_sync is not UNSET:
            field_dict["last_sync"] = last_sync
        if private is not UNSET:
            field_dict["private"] = private
        if provider is not UNSET:
            field_dict["provider"] = provider
        if refresh_token is not UNSET:
            field_dict["refresh_token"] = refresh_token
        if status is not UNSET:
            field_dict["status"] = status
        if sync_mutex is not UNSET:
            field_dict["sync_mutex"] = sync_mutex

        return field_dict

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        types_email_config = cls(
            access_token=access_token,
            address=address,
            auto_reply=auto_reply,
            auto_reply_body=auto_reply_body,
            auto_reply_from=auto_reply_from,
            auto_reply_subject=auto_reply_subject,
            auto_reply_to=auto_reply_to,
            connected_at=connected_at,
            error=error,
            errored_at=errored_at,
            last_sync=last_sync,
            private=private,
            provider=provider,
            refresh_token=refresh_token,
            status=status,
            sync_mutex=sync_mutex,
        )

        types_email_config.additional_properties = d
        return types_email_config

    @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
