"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from datetime import date
from gusto_embedded.types import (
    BaseModel,
    Nullable,
    OptionalNullable,
    UNSET,
    UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import Optional
from typing_extensions import NotRequired, TypedDict


class WorkAddressTypedDict(TypedDict):
    location_uuid: NotRequired[str]
    r"""Reference to a company location"""


class WorkAddress(BaseModel):
    location_uuid: Optional[str] = None
    r"""Reference to a company location"""


class HistoricalEmployeeBodyHomeAddressTypedDict(TypedDict):
    street_1: str
    city: str
    state: str
    zip: str
    street_2: NotRequired[Nullable[str]]


class HistoricalEmployeeBodyHomeAddress(BaseModel):
    street_1: str

    city: str

    state: str

    zip: str

    street_2: OptionalNullable[str] = UNSET

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = ["street_2"]
        nullable_fields = ["street_2"]
        null_default_fields = []

        serialized = handler(self)

        m = {}

        for n, f in self.model_fields.items():
            k = f.alias or n
            val = serialized.get(k)
            serialized.pop(k, None)

            optional_nullable = k in optional_fields and k in nullable_fields
            is_set = (
                self.__pydantic_fields_set__.intersection({n})
                or k in null_default_fields
            )  # pylint: disable=no-member

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields or (optional_nullable and is_set)
            ):
                m[k] = val

        return m


class HistoricalEmployeeBodyTerminationTypedDict(TypedDict):
    effective_date: NotRequired[date]
    r"""Date the employee was terminated from the company"""


class HistoricalEmployeeBodyTermination(BaseModel):
    effective_date: Optional[date] = None
    r"""Date the employee was terminated from the company"""


class HistoricalEmployeeBodyJobTypedDict(TypedDict):
    hire_date: NotRequired[date]
    r"""The date when the employee was hired to the company"""


class HistoricalEmployeeBodyJob(BaseModel):
    hire_date: Optional[date] = None
    r"""The date when the employee was hired to the company"""


class EmployeeStateTaxesTypedDict(TypedDict):
    wc_covered: NotRequired[bool]
    r"""Whether this job is eligible for workers' compensation coverage in the states of Washington (WA) or Wyoming (WY)."""
    wc_class_code: NotRequired[str]
    r"""The risk class code for workers' compensation in Washington or Wyoming state. For Washington, visit [Washington state's Risk Class page](https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/) to learn more. For Wyoming you can search for the code online using [WY Workforce Services website](https://dws.wyo.gov/dws-division/workers-compensation/) or call the agency at (307) 235-3217."""


class EmployeeStateTaxes(BaseModel):
    wc_covered: Optional[bool] = None
    r"""Whether this job is eligible for workers' compensation coverage in the states of Washington (WA) or Wyoming (WY)."""

    wc_class_code: Optional[str] = None
    r"""The risk class code for workers' compensation in Washington or Wyoming state. For Washington, visit [Washington state's Risk Class page](https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/) to learn more. For Wyoming you can search for the code online using [WY Workforce Services website](https://dws.wyo.gov/dws-division/workers-compensation/) or call the agency at (307) 235-3217."""


class HistoricalEmployeeBodyTypedDict(TypedDict):
    first_name: str
    last_name: str
    date_of_birth: str
    ssn: str
    work_address: WorkAddressTypedDict
    home_address: HistoricalEmployeeBodyHomeAddressTypedDict
    termination: HistoricalEmployeeBodyTerminationTypedDict
    job: HistoricalEmployeeBodyJobTypedDict
    middle_initial: NotRequired[str]
    preferred_first_name: NotRequired[str]
    email: NotRequired[str]
    r"""Optional. If provided, the email address will be saved to the employee."""
    employee_state_taxes: NotRequired[EmployeeStateTaxesTypedDict]


class HistoricalEmployeeBody(BaseModel):
    first_name: str

    last_name: str

    date_of_birth: str

    ssn: str

    work_address: WorkAddress

    home_address: HistoricalEmployeeBodyHomeAddress

    termination: HistoricalEmployeeBodyTermination

    job: HistoricalEmployeeBodyJob

    middle_initial: Optional[str] = None

    preferred_first_name: Optional[str] = None

    email: Optional[str] = None
    r"""Optional. If provided, the email address will be saved to the employee."""

    employee_state_taxes: Optional[EmployeeStateTaxes] = None
