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


@_attrs_define
class LegacytypesClientTaskData:
    """
    Attributes:
        client_editable (bool | Unset): If true, the client can edit the form
        destination (str | Unset):
        download_file (str | Unset):
        file_upload (str | Unset):
        follow_up_interval (int | Unset):
        follow_up_to (list[str] | Unset):
        form_file (str | Unset):
        form_response (str | Unset): Results
        form_template (str | Unset):
        last_follow_up (str | Unset):
        notice_file (str | Unset):
        payroll_enabled (str | Unset):
        py (str | Unset):
        show (bool | Unset): Show boolean
        submit_task_id (str | Unset):
        url (str | Unset):
    """

    client_editable: bool | Unset = UNSET
    destination: str | Unset = UNSET
    download_file: str | Unset = UNSET
    file_upload: str | Unset = UNSET
    follow_up_interval: int | Unset = UNSET
    follow_up_to: list[str] | Unset = UNSET
    form_file: str | Unset = UNSET
    form_response: str | Unset = UNSET
    form_template: str | Unset = UNSET
    last_follow_up: str | Unset = UNSET
    notice_file: str | Unset = UNSET
    payroll_enabled: str | Unset = UNSET
    py: str | Unset = UNSET
    show: bool | Unset = UNSET
    submit_task_id: str | Unset = UNSET
    url: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        destination = self.destination

        download_file = self.download_file

        file_upload = self.file_upload

        follow_up_interval = self.follow_up_interval

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

        form_file = self.form_file

        form_response = self.form_response

        form_template = self.form_template

        last_follow_up = self.last_follow_up

        notice_file = self.notice_file

        payroll_enabled = self.payroll_enabled

        py = self.py

        show = self.show

        submit_task_id = self.submit_task_id

        url = self.url

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client_editable is not UNSET:
            field_dict["client_editable"] = client_editable
        if destination is not UNSET:
            field_dict["destination"] = destination
        if download_file is not UNSET:
            field_dict["download_file"] = download_file
        if file_upload is not UNSET:
            field_dict["file_upload"] = file_upload
        if follow_up_interval is not UNSET:
            field_dict["follow_up_interval"] = follow_up_interval
        if follow_up_to is not UNSET:
            field_dict["follow_up_to"] = follow_up_to
        if form_file is not UNSET:
            field_dict["form_file"] = form_file
        if form_response is not UNSET:
            field_dict["form_response"] = form_response
        if form_template is not UNSET:
            field_dict["form_template"] = form_template
        if last_follow_up is not UNSET:
            field_dict["last_follow_up"] = last_follow_up
        if notice_file is not UNSET:
            field_dict["notice_file"] = notice_file
        if payroll_enabled is not UNSET:
            field_dict["payroll_enabled"] = payroll_enabled
        if py is not UNSET:
            field_dict["py"] = py
        if show is not UNSET:
            field_dict["show"] = show
        if submit_task_id is not UNSET:
            field_dict["submit_task_id"] = submit_task_id
        if url is not UNSET:
            field_dict["url"] = url

        return field_dict

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        legacytypes_client_task_data = cls(
            client_editable=client_editable,
            destination=destination,
            download_file=download_file,
            file_upload=file_upload,
            follow_up_interval=follow_up_interval,
            follow_up_to=follow_up_to,
            form_file=form_file,
            form_response=form_response,
            form_template=form_template,
            last_follow_up=last_follow_up,
            notice_file=notice_file,
            payroll_enabled=payroll_enabled,
            py=py,
            show=show,
            submit_task_id=submit_task_id,
            url=url,
        )

        legacytypes_client_task_data.additional_properties = d
        return legacytypes_client_task_data

    @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
