from __future__ import annotations

from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar, cast

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

if TYPE_CHECKING:
    from ..models.legacytypes_e_fast_data_schedule_instances import LegacytypesEFastDataScheduleInstances


T = TypeVar("T", bound="LegacytypesEFastData")


@_attrs_define
class LegacytypesEFastData:
    """
    Attributes:
        attachments (list[Any] | Unset):
        dcg_attachments (list[Any] | Unset):
        file_names (list[str] | Unset):
        form (str | Unset):
        schedule_instances (LegacytypesEFastDataScheduleInstances | Unset):
        schedules (list[str] | Unset):
    """

    attachments: list[Any] | Unset = UNSET
    dcg_attachments: list[Any] | Unset = UNSET
    file_names: list[str] | Unset = UNSET
    form: str | Unset = UNSET
    schedule_instances: LegacytypesEFastDataScheduleInstances | Unset = UNSET
    schedules: list[str] | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        attachments: list[Any] | Unset = UNSET
        if not isinstance(self.attachments, Unset):
            attachments = self.attachments

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

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

        form = self.form

        schedule_instances: dict[str, Any] | Unset = UNSET
        if not isinstance(self.schedule_instances, Unset):
            schedule_instances = self.schedule_instances.to_dict()

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if attachments is not UNSET:
            field_dict["attachments"] = attachments
        if dcg_attachments is not UNSET:
            field_dict["dcg_attachments"] = dcg_attachments
        if file_names is not UNSET:
            field_dict["file_names"] = file_names
        if form is not UNSET:
            field_dict["form"] = form
        if schedule_instances is not UNSET:
            field_dict["schedule_instances"] = schedule_instances
        if schedules is not UNSET:
            field_dict["schedules"] = schedules

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.legacytypes_e_fast_data_schedule_instances import LegacytypesEFastDataScheduleInstances

        d = dict(src_dict)
        attachments = cast(list[Any], d.pop("attachments", UNSET))

        dcg_attachments = cast(list[Any], d.pop("dcg_attachments", UNSET))

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

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

        _schedule_instances = d.pop("schedule_instances", UNSET)
        schedule_instances: LegacytypesEFastDataScheduleInstances | Unset
        if isinstance(_schedule_instances, Unset):
            schedule_instances = UNSET
        else:
            schedule_instances = LegacytypesEFastDataScheduleInstances.from_dict(_schedule_instances)

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

        legacytypes_e_fast_data = cls(
            attachments=attachments,
            dcg_attachments=dcg_attachments,
            file_names=file_names,
            form=form,
            schedule_instances=schedule_instances,
            schedules=schedules,
        )

        legacytypes_e_fast_data.additional_properties = d
        return legacytypes_e_fast_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
