from __future__ import annotations

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

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

from ..types import UNSET, Unset

if TYPE_CHECKING:
    from ..models.pkg_routes_compliance_submit_5500_request_form_5500 import (
        PkgRoutesComplianceSubmit5500RequestForm5500,
    )
    from ..models.pkg_routes_compliance_submit_5500_request_form_5558 import (
        PkgRoutesComplianceSubmit5500RequestForm5558,
    )
    from ..models.pkg_routes_compliance_submit_5500_request_form_ez import PkgRoutesComplianceSubmit5500RequestFormEz
    from ..models.pkg_routes_compliance_submit_5500_request_form_sf import PkgRoutesComplianceSubmit5500RequestFormSf
    from ..models.pkg_routes_compliance_submit_5500_request_schedules import (
        PkgRoutesComplianceSubmit5500RequestSchedules,
    )
    from ..models.pkg_routes_compliance_submit_5500_request_structured_attachments import (
        PkgRoutesComplianceSubmit5500RequestStructuredAttachments,
    )
    from ..models.stax_ai_cx_cx_api_pkg_routes_helpers_attachment import StaxAiCxCxApiPkgRoutesHelpersAttachment
    from ..models.stax_ai_cx_cx_api_pkg_routes_helpers_dcg_attachment import StaxAiCxCxApiPkgRoutesHelpersDCGAttachment


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


@_attrs_define
class PkgRoutesComplianceSubmit5500Request:
    """
    Attributes:
        attachments (list[StaxAiCxCxApiPkgRoutesHelpersAttachment] | Unset):
        dcg_attachments (list[StaxAiCxCxApiPkgRoutesHelpersDCGAttachment] | Unset):
        form_5500 (PkgRoutesComplianceSubmit5500RequestForm5500 | Unset):
        form_5558 (PkgRoutesComplianceSubmit5500RequestForm5558 | Unset):
        form_ez (PkgRoutesComplianceSubmit5500RequestFormEz | Unset):
        form_sf (PkgRoutesComplianceSubmit5500RequestFormSf | Unset):
        form_type (str | Unset):
        schedules (PkgRoutesComplianceSubmit5500RequestSchedules | Unset):
        structured_attachments (PkgRoutesComplianceSubmit5500RequestStructuredAttachments | Unset):
        submit_with_warnings (bool | Unset):
        validation (bool | Unset):
        year (int | Unset):
    """

    attachments: list[StaxAiCxCxApiPkgRoutesHelpersAttachment] | Unset = UNSET
    dcg_attachments: list[StaxAiCxCxApiPkgRoutesHelpersDCGAttachment] | Unset = UNSET
    form_5500: PkgRoutesComplianceSubmit5500RequestForm5500 | Unset = UNSET
    form_5558: PkgRoutesComplianceSubmit5500RequestForm5558 | Unset = UNSET
    form_ez: PkgRoutesComplianceSubmit5500RequestFormEz | Unset = UNSET
    form_sf: PkgRoutesComplianceSubmit5500RequestFormSf | Unset = UNSET
    form_type: str | Unset = UNSET
    schedules: PkgRoutesComplianceSubmit5500RequestSchedules | Unset = UNSET
    structured_attachments: PkgRoutesComplianceSubmit5500RequestStructuredAttachments | Unset = UNSET
    submit_with_warnings: bool | Unset = UNSET
    validation: bool | Unset = UNSET
    year: int | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        dcg_attachments: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.dcg_attachments, Unset):
            dcg_attachments = []
            for dcg_attachments_item_data in self.dcg_attachments:
                dcg_attachments_item = dcg_attachments_item_data.to_dict()
                dcg_attachments.append(dcg_attachments_item)

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

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

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

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

        form_type = self.form_type

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

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

        submit_with_warnings = self.submit_with_warnings

        validation = self.validation

        year = self.year

        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 form_5500 is not UNSET:
            field_dict["form_5500"] = form_5500
        if form_5558 is not UNSET:
            field_dict["form_5558"] = form_5558
        if form_ez is not UNSET:
            field_dict["form_ez"] = form_ez
        if form_sf is not UNSET:
            field_dict["form_sf"] = form_sf
        if form_type is not UNSET:
            field_dict["form_type"] = form_type
        if schedules is not UNSET:
            field_dict["schedules"] = schedules
        if structured_attachments is not UNSET:
            field_dict["structured_attachments"] = structured_attachments
        if submit_with_warnings is not UNSET:
            field_dict["submit_with_warnings"] = submit_with_warnings
        if validation is not UNSET:
            field_dict["validation"] = validation
        if year is not UNSET:
            field_dict["year"] = year

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.pkg_routes_compliance_submit_5500_request_form_5500 import (
            PkgRoutesComplianceSubmit5500RequestForm5500,
        )
        from ..models.pkg_routes_compliance_submit_5500_request_form_5558 import (
            PkgRoutesComplianceSubmit5500RequestForm5558,
        )
        from ..models.pkg_routes_compliance_submit_5500_request_form_ez import (
            PkgRoutesComplianceSubmit5500RequestFormEz,
        )
        from ..models.pkg_routes_compliance_submit_5500_request_form_sf import (
            PkgRoutesComplianceSubmit5500RequestFormSf,
        )
        from ..models.pkg_routes_compliance_submit_5500_request_schedules import (
            PkgRoutesComplianceSubmit5500RequestSchedules,
        )
        from ..models.pkg_routes_compliance_submit_5500_request_structured_attachments import (
            PkgRoutesComplianceSubmit5500RequestStructuredAttachments,
        )
        from ..models.stax_ai_cx_cx_api_pkg_routes_helpers_attachment import StaxAiCxCxApiPkgRoutesHelpersAttachment
        from ..models.stax_ai_cx_cx_api_pkg_routes_helpers_dcg_attachment import (
            StaxAiCxCxApiPkgRoutesHelpersDCGAttachment,
        )

        d = dict(src_dict)
        _attachments = d.pop("attachments", UNSET)
        attachments: list[StaxAiCxCxApiPkgRoutesHelpersAttachment] | Unset = UNSET
        if _attachments is not UNSET:
            attachments = []
            for attachments_item_data in _attachments:
                attachments_item = StaxAiCxCxApiPkgRoutesHelpersAttachment.from_dict(attachments_item_data)

                attachments.append(attachments_item)

        _dcg_attachments = d.pop("dcg_attachments", UNSET)
        dcg_attachments: list[StaxAiCxCxApiPkgRoutesHelpersDCGAttachment] | Unset = UNSET
        if _dcg_attachments is not UNSET:
            dcg_attachments = []
            for dcg_attachments_item_data in _dcg_attachments:
                dcg_attachments_item = StaxAiCxCxApiPkgRoutesHelpersDCGAttachment.from_dict(dcg_attachments_item_data)

                dcg_attachments.append(dcg_attachments_item)

        _form_5500 = d.pop("form_5500", UNSET)
        form_5500: PkgRoutesComplianceSubmit5500RequestForm5500 | Unset
        if isinstance(_form_5500, Unset):
            form_5500 = UNSET
        else:
            form_5500 = PkgRoutesComplianceSubmit5500RequestForm5500.from_dict(_form_5500)

        _form_5558 = d.pop("form_5558", UNSET)
        form_5558: PkgRoutesComplianceSubmit5500RequestForm5558 | Unset
        if isinstance(_form_5558, Unset):
            form_5558 = UNSET
        else:
            form_5558 = PkgRoutesComplianceSubmit5500RequestForm5558.from_dict(_form_5558)

        _form_ez = d.pop("form_ez", UNSET)
        form_ez: PkgRoutesComplianceSubmit5500RequestFormEz | Unset
        if isinstance(_form_ez, Unset):
            form_ez = UNSET
        else:
            form_ez = PkgRoutesComplianceSubmit5500RequestFormEz.from_dict(_form_ez)

        _form_sf = d.pop("form_sf", UNSET)
        form_sf: PkgRoutesComplianceSubmit5500RequestFormSf | Unset
        if isinstance(_form_sf, Unset):
            form_sf = UNSET
        else:
            form_sf = PkgRoutesComplianceSubmit5500RequestFormSf.from_dict(_form_sf)

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

        _schedules = d.pop("schedules", UNSET)
        schedules: PkgRoutesComplianceSubmit5500RequestSchedules | Unset
        if isinstance(_schedules, Unset):
            schedules = UNSET
        else:
            schedules = PkgRoutesComplianceSubmit5500RequestSchedules.from_dict(_schedules)

        _structured_attachments = d.pop("structured_attachments", UNSET)
        structured_attachments: PkgRoutesComplianceSubmit5500RequestStructuredAttachments | Unset
        if isinstance(_structured_attachments, Unset):
            structured_attachments = UNSET
        else:
            structured_attachments = PkgRoutesComplianceSubmit5500RequestStructuredAttachments.from_dict(
                _structured_attachments
            )

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

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

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

        pkg_routes_compliance_submit_5500_request = cls(
            attachments=attachments,
            dcg_attachments=dcg_attachments,
            form_5500=form_5500,
            form_5558=form_5558,
            form_ez=form_ez,
            form_sf=form_sf,
            form_type=form_type,
            schedules=schedules,
            structured_attachments=structured_attachments,
            submit_with_warnings=submit_with_warnings,
            validation=validation,
            year=year,
        )

        pkg_routes_compliance_submit_5500_request.additional_properties = d
        return pkg_routes_compliance_submit_5500_request

    @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
