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


@_attrs_define
class TypesEmployeeCensusCheckError:
    """
    Attributes:
        custom (str | Unset):
        detail (str | Unset):
        duplicate (bool | Unset):
        employee_census_path (list[str] | Unset):
        employee_path (list[str] | Unset):
        field_names (list[str] | Unset): Based on specific data paths, we can render the appropriate UI (eg. name should
            separate first and last name, address should have a full address editor, SSN and emails should have validation
            built-in)
        force (bool | Unset):
        instruction (str | Unset):
        last_year_value (Any | Unset):
        plan (str | Unset):
        reason (str | Unset):
        reviewed (bool | Unset):
    """

    custom: str | Unset = UNSET
    detail: str | Unset = UNSET
    duplicate: bool | Unset = UNSET
    employee_census_path: list[str] | Unset = UNSET
    employee_path: list[str] | Unset = UNSET
    field_names: list[str] | Unset = UNSET
    force: bool | Unset = UNSET
    instruction: str | Unset = UNSET
    last_year_value: Any | Unset = UNSET
    plan: str | Unset = UNSET
    reason: str | Unset = UNSET
    reviewed: bool | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        detail = self.detail

        duplicate = self.duplicate

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

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

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

        force = self.force

        instruction = self.instruction

        last_year_value = self.last_year_value

        plan = self.plan

        reason = self.reason

        reviewed = self.reviewed

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if custom is not UNSET:
            field_dict["custom"] = custom
        if detail is not UNSET:
            field_dict["detail"] = detail
        if duplicate is not UNSET:
            field_dict["duplicate"] = duplicate
        if employee_census_path is not UNSET:
            field_dict["employee_census_path"] = employee_census_path
        if employee_path is not UNSET:
            field_dict["employee_path"] = employee_path
        if field_names is not UNSET:
            field_dict["field_names"] = field_names
        if force is not UNSET:
            field_dict["force"] = force
        if instruction is not UNSET:
            field_dict["instruction"] = instruction
        if last_year_value is not UNSET:
            field_dict["last_year_value"] = last_year_value
        if plan is not UNSET:
            field_dict["plan"] = plan
        if reason is not UNSET:
            field_dict["reason"] = reason
        if reviewed is not UNSET:
            field_dict["reviewed"] = reviewed

        return field_dict

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

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

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

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

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

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

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

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

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

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

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

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

        types_employee_census_check_error = cls(
            custom=custom,
            detail=detail,
            duplicate=duplicate,
            employee_census_path=employee_census_path,
            employee_path=employee_path,
            field_names=field_names,
            force=force,
            instruction=instruction,
            last_year_value=last_year_value,
            plan=plan,
            reason=reason,
            reviewed=reviewed,
        )

        types_employee_census_check_error.additional_properties = d
        return types_employee_census_check_error

    @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
