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_packages_retirement_participants_employee_census_update_request_census import (
        PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestCensus,
    )
    from ..models.pkg_routes_packages_retirement_participants_employee_census_update_request_employee import (
        PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestEmployee,
    )


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


@_attrs_define
class PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequest:
    """
    Attributes:
        census (PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestCensus | Unset):
        employee (PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestEmployee | Unset):
    """

    census: PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestCensus | Unset = UNSET
    employee: PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestEmployee | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if census is not UNSET:
            field_dict["census"] = census
        if employee is not UNSET:
            field_dict["employee"] = employee

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.pkg_routes_packages_retirement_participants_employee_census_update_request_census import (
            PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestCensus,
        )
        from ..models.pkg_routes_packages_retirement_participants_employee_census_update_request_employee import (
            PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestEmployee,
        )

        d = dict(src_dict)
        _census = d.pop("census", UNSET)
        census: PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestCensus | Unset
        if isinstance(_census, Unset):
            census = UNSET
        else:
            census = PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestCensus.from_dict(_census)

        _employee = d.pop("employee", UNSET)
        employee: PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestEmployee | Unset
        if isinstance(_employee, Unset):
            employee = UNSET
        else:
            employee = PkgRoutesPackagesRetirementParticipantsEmployeeCensusUpdateRequestEmployee.from_dict(_employee)

        pkg_routes_packages_retirement_participants_employee_census_update_request = cls(
            census=census,
            employee=employee,
        )

        pkg_routes_packages_retirement_participants_employee_census_update_request.additional_properties = d
        return pkg_routes_packages_retirement_participants_employee_census_update_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
