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

from __future__ import annotations
from .versionheader import VersionHeader
from enum import Enum
from gusto_embedded.types import BaseModel
from gusto_embedded.utils import (
    FieldMetadata,
    HeaderMetadata,
    PathParamMetadata,
    RequestMetadata,
)
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class PutV1ExternalPayrollEarningType(str, Enum):
    r"""The earning type for the compensation."""

    COMPANY_PAY_TYPE = "CompanyPayType"
    COMPANY_EARNING_TYPE = "CompanyEarningType"


class PutV1ExternalPayrollEarningsTypedDict(TypedDict):
    r"""An array of earnings for the employee. Depends on your company selections, earnings includes wages, hours, bonuses, tips, commission and more."""

    hours: NotRequired[str]
    r"""The hour of the compensation for the pay period."""
    amount: NotRequired[str]
    r"""The amount of the earning."""
    earning_id: NotRequired[int]
    r"""The ID of the earning."""
    earning_type: NotRequired[PutV1ExternalPayrollEarningType]
    r"""The earning type for the compensation."""


class PutV1ExternalPayrollEarnings(BaseModel):
    r"""An array of earnings for the employee. Depends on your company selections, earnings includes wages, hours, bonuses, tips, commission and more."""

    hours: Optional[str] = None
    r"""The hour of the compensation for the pay period."""

    amount: Optional[str] = None
    r"""The amount of the earning."""

    earning_id: Optional[int] = None
    r"""The ID of the earning."""

    earning_type: Optional[PutV1ExternalPayrollEarningType] = None
    r"""The earning type for the compensation."""


class PutV1ExternalPayrollBenefitsTypedDict(TypedDict):
    r"""An array of benefits for the employee. Depends on your company selections, benefits include 401k, health insurance and more."""

    company_contribution_amount: NotRequired[str]
    r"""Company contribution amount towards the benefit"""
    employee_deduction_amount: NotRequired[str]
    r"""Employee deduction amount towards the benefit"""
    benefit_id: NotRequired[int]
    r"""The ID of the benefit."""


class PutV1ExternalPayrollBenefits(BaseModel):
    r"""An array of benefits for the employee. Depends on your company selections, benefits include 401k, health insurance and more."""

    company_contribution_amount: Optional[str] = None
    r"""Company contribution amount towards the benefit"""

    employee_deduction_amount: Optional[str] = None
    r"""Employee deduction amount towards the benefit"""

    benefit_id: Optional[int] = None
    r"""The ID of the benefit."""


class PutV1ExternalPayrollTaxesTypedDict(TypedDict):
    amount: NotRequired[str]
    r"""The amount of the tax."""
    tax_id: NotRequired[int]
    r"""The ID of the tax."""


class PutV1ExternalPayrollTaxes(BaseModel):
    amount: Optional[str] = None
    r"""The amount of the tax."""

    tax_id: Optional[int] = None
    r"""The ID of the tax."""


class PutV1ExternalPayrollExternalPayrollItemsTypedDict(TypedDict):
    r"""Submit wages, benefits, taxes for each employee"""

    employee_uuid: NotRequired[str]
    r"""The UUID of the employee."""
    earnings: NotRequired[List[PutV1ExternalPayrollEarningsTypedDict]]
    benefits: NotRequired[List[PutV1ExternalPayrollBenefitsTypedDict]]
    taxes: NotRequired[List[PutV1ExternalPayrollTaxesTypedDict]]
    r"""An array of taxes for the employee. Depends on your company selections, taxes include federal income tax, social security, medicare, and more."""


class PutV1ExternalPayrollExternalPayrollItems(BaseModel):
    r"""Submit wages, benefits, taxes for each employee"""

    employee_uuid: Optional[str] = None
    r"""The UUID of the employee."""

    earnings: Optional[List[PutV1ExternalPayrollEarnings]] = None

    benefits: Optional[List[PutV1ExternalPayrollBenefits]] = None

    taxes: Optional[List[PutV1ExternalPayrollTaxes]] = None
    r"""An array of taxes for the employee. Depends on your company selections, taxes include federal income tax, social security, medicare, and more."""


class PutV1ExternalPayrollRequestBodyTypedDict(TypedDict):
    replace_fields: NotRequired[bool]
    r"""Patch update external payroll items when set to true, otherwise it will overwrite the previous changes."""
    external_payroll_items: NotRequired[
        List[PutV1ExternalPayrollExternalPayrollItemsTypedDict]
    ]


class PutV1ExternalPayrollRequestBody(BaseModel):
    replace_fields: Optional[bool] = None
    r"""Patch update external payroll items when set to true, otherwise it will overwrite the previous changes."""

    external_payroll_items: Optional[List[PutV1ExternalPayrollExternalPayrollItems]] = (
        None
    )


class PutV1ExternalPayrollRequestTypedDict(TypedDict):
    company_uuid: str
    r"""The UUID of the company"""
    external_payroll_id: str
    r"""The UUID of the external payroll"""
    request_body: PutV1ExternalPayrollRequestBodyTypedDict
    x_gusto_api_version: NotRequired[VersionHeader]
    r"""Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used."""


class PutV1ExternalPayrollRequest(BaseModel):
    company_uuid: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""The UUID of the company"""

    external_payroll_id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""The UUID of the external payroll"""

    request_body: Annotated[
        PutV1ExternalPayrollRequestBody,
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ]

    x_gusto_api_version: Annotated[
        Optional[VersionHeader],
        pydantic.Field(alias="X-Gusto-API-Version"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = VersionHeader.TWO_THOUSAND_AND_TWENTY_FOUR_04_01
    r"""Determines the date-based API version associated with your API call. If none is provided, your application's [minimum API version](https://docs.gusto.com/embedded-payroll/docs/api-versioning#minimum-api-version) is used."""
