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_admin_parse_reports_payroll_run import PkgRoutesAdminParseReportsPayrollRun
    from ..models.types_client import TypesClient
    from ..models.types_client_payroll import TypesClientPayroll
    from ..models.types_payroll_report import TypesPayrollReport
    from ..models.types_payroll_report_parser import TypesPayrollReportParser
    from ..models.types_retirement_plan import TypesRetirementPlan
    from ..models.types_short_team import TypesShortTeam


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


@_attrs_define
class PkgRoutesAdminParseReportsListReportsResponse:
    """
    Attributes:
        client (TypesClient | Unset):
        client_payroll (TypesClientPayroll | Unset):
        parsers (list[TypesPayrollReportParser] | Unset):
        payrolls (list[PkgRoutesAdminParseReportsPayrollRun] | Unset):
        plans (list[TypesRetirementPlan] | Unset):
        reports (list[TypesPayrollReport] | Unset):
        team (TypesShortTeam | Unset):
    """

    client: TypesClient | Unset = UNSET
    client_payroll: TypesClientPayroll | Unset = UNSET
    parsers: list[TypesPayrollReportParser] | Unset = UNSET
    payrolls: list[PkgRoutesAdminParseReportsPayrollRun] | Unset = UNSET
    plans: list[TypesRetirementPlan] | Unset = UNSET
    reports: list[TypesPayrollReport] | Unset = UNSET
    team: TypesShortTeam | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

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

        parsers: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.parsers, Unset):
            parsers = []
            for parsers_item_data in self.parsers:
                parsers_item = parsers_item_data.to_dict()
                parsers.append(parsers_item)

        payrolls: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.payrolls, Unset):
            payrolls = []
            for payrolls_item_data in self.payrolls:
                payrolls_item = payrolls_item_data.to_dict()
                payrolls.append(payrolls_item)

        plans: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.plans, Unset):
            plans = []
            for plans_item_data in self.plans:
                plans_item = plans_item_data.to_dict()
                plans.append(plans_item)

        reports: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.reports, Unset):
            reports = []
            for reports_item_data in self.reports:
                reports_item = reports_item_data.to_dict()
                reports.append(reports_item)

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client is not UNSET:
            field_dict["client"] = client
        if client_payroll is not UNSET:
            field_dict["client_payroll"] = client_payroll
        if parsers is not UNSET:
            field_dict["parsers"] = parsers
        if payrolls is not UNSET:
            field_dict["payrolls"] = payrolls
        if plans is not UNSET:
            field_dict["plans"] = plans
        if reports is not UNSET:
            field_dict["reports"] = reports
        if team is not UNSET:
            field_dict["team"] = team

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.pkg_routes_admin_parse_reports_payroll_run import PkgRoutesAdminParseReportsPayrollRun
        from ..models.types_client import TypesClient
        from ..models.types_client_payroll import TypesClientPayroll
        from ..models.types_payroll_report import TypesPayrollReport
        from ..models.types_payroll_report_parser import TypesPayrollReportParser
        from ..models.types_retirement_plan import TypesRetirementPlan
        from ..models.types_short_team import TypesShortTeam

        d = dict(src_dict)
        _client = d.pop("client", UNSET)
        client: TypesClient | Unset
        if isinstance(_client, Unset):
            client = UNSET
        else:
            client = TypesClient.from_dict(_client)

        _client_payroll = d.pop("client_payroll", UNSET)
        client_payroll: TypesClientPayroll | Unset
        if isinstance(_client_payroll, Unset):
            client_payroll = UNSET
        else:
            client_payroll = TypesClientPayroll.from_dict(_client_payroll)

        _parsers = d.pop("parsers", UNSET)
        parsers: list[TypesPayrollReportParser] | Unset = UNSET
        if _parsers is not UNSET:
            parsers = []
            for parsers_item_data in _parsers:
                parsers_item = TypesPayrollReportParser.from_dict(parsers_item_data)

                parsers.append(parsers_item)

        _payrolls = d.pop("payrolls", UNSET)
        payrolls: list[PkgRoutesAdminParseReportsPayrollRun] | Unset = UNSET
        if _payrolls is not UNSET:
            payrolls = []
            for payrolls_item_data in _payrolls:
                payrolls_item = PkgRoutesAdminParseReportsPayrollRun.from_dict(payrolls_item_data)

                payrolls.append(payrolls_item)

        _plans = d.pop("plans", UNSET)
        plans: list[TypesRetirementPlan] | Unset = UNSET
        if _plans is not UNSET:
            plans = []
            for plans_item_data in _plans:
                plans_item = TypesRetirementPlan.from_dict(plans_item_data)

                plans.append(plans_item)

        _reports = d.pop("reports", UNSET)
        reports: list[TypesPayrollReport] | Unset = UNSET
        if _reports is not UNSET:
            reports = []
            for reports_item_data in _reports:
                reports_item = TypesPayrollReport.from_dict(reports_item_data)

                reports.append(reports_item)

        _team = d.pop("team", UNSET)
        team: TypesShortTeam | Unset
        if isinstance(_team, Unset):
            team = UNSET
        else:
            team = TypesShortTeam.from_dict(_team)

        pkg_routes_admin_parse_reports_list_reports_response = cls(
            client=client,
            client_payroll=client_payroll,
            parsers=parsers,
            payrolls=payrolls,
            plans=plans,
            reports=reports,
            team=team,
        )

        pkg_routes_admin_parse_reports_list_reports_response.additional_properties = d
        return pkg_routes_admin_parse_reports_list_reports_response

    @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
