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


@_attrs_define
class TypesTriggerConfig:
    """
    Attributes:
        form_email_field (str | Unset):
        form_file_field (str | Unset):
        form_name_field (str | Unset):
        form_template (str | Unset):
        lead (str | Unset): Must evaluate
        payroll_trigger_clients (int | Unset):
        type_ (str | Unset):
    """

    form_email_field: str | Unset = UNSET
    form_file_field: str | Unset = UNSET
    form_name_field: str | Unset = UNSET
    form_template: str | Unset = UNSET
    lead: str | Unset = UNSET
    payroll_trigger_clients: int | Unset = UNSET
    type_: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        form_file_field = self.form_file_field

        form_name_field = self.form_name_field

        form_template = self.form_template

        lead = self.lead

        payroll_trigger_clients = self.payroll_trigger_clients

        type_ = self.type_

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if form_email_field is not UNSET:
            field_dict["form_email_field"] = form_email_field
        if form_file_field is not UNSET:
            field_dict["form_file_field"] = form_file_field
        if form_name_field is not UNSET:
            field_dict["form_name_field"] = form_name_field
        if form_template is not UNSET:
            field_dict["form_template"] = form_template
        if lead is not UNSET:
            field_dict["lead"] = lead
        if payroll_trigger_clients is not UNSET:
            field_dict["payroll_trigger_clients"] = payroll_trigger_clients
        if type_ is not UNSET:
            field_dict["type"] = type_

        return field_dict

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

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

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

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

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

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

        type_ = d.pop("type", UNSET)

        types_trigger_config = cls(
            form_email_field=form_email_field,
            form_file_field=form_file_field,
            form_name_field=form_name_field,
            form_template=form_template,
            lead=lead,
            payroll_trigger_clients=payroll_trigger_clients,
            type_=type_,
        )

        types_trigger_config.additional_properties = d
        return types_trigger_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
