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


@_attrs_define
class TypesClientFollowUpConfig:
    """
    Attributes:
        follow_up_enabled (bool | Unset):
        message (str | Unset):
        send_interval_after_due (int | Unset):
        send_interval_before_due (int | Unset):
        send_until (int | Unset):
    """

    follow_up_enabled: bool | Unset = UNSET
    message: str | Unset = UNSET
    send_interval_after_due: int | Unset = UNSET
    send_interval_before_due: int | Unset = UNSET
    send_until: int | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        message = self.message

        send_interval_after_due = self.send_interval_after_due

        send_interval_before_due = self.send_interval_before_due

        send_until = self.send_until

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if follow_up_enabled is not UNSET:
            field_dict["follow_up_enabled"] = follow_up_enabled
        if message is not UNSET:
            field_dict["message"] = message
        if send_interval_after_due is not UNSET:
            field_dict["send_interval_after_due"] = send_interval_after_due
        if send_interval_before_due is not UNSET:
            field_dict["send_interval_before_due"] = send_interval_before_due
        if send_until is not UNSET:
            field_dict["send_until"] = send_until

        return field_dict

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

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

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

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

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

        types_client_follow_up_config = cls(
            follow_up_enabled=follow_up_enabled,
            message=message,
            send_interval_after_due=send_interval_after_due,
            send_interval_before_due=send_interval_before_due,
            send_until=send_until,
        )

        types_client_follow_up_config.additional_properties = d
        return types_client_follow_up_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
