# This file was auto-generated by Fern from our API Definition.

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .job_assignment_pay_type import JobAssignmentPayType
from .money import Money
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class JobAssignment(UncheckedBaseModel):
    """
    Represents a job assigned to a [team member](entity:TeamMember), including the compensation the team
    member earns for the job. Job assignments are listed in the team member's [wage setting](entity:WageSetting).
    """

    job_title: typing.Optional[str] = pydantic.Field(default=None)
    """
    The title of the job.
    """

    pay_type: JobAssignmentPayType = pydantic.Field()
    """
    The current pay type for the job assignment used to
    calculate the pay amount in a pay period.
    See [JobAssignmentPayType](#type-jobassignmentpaytype) for possible values
    """

    hourly_rate: typing.Optional[Money] = pydantic.Field(default=None)
    """
    The hourly pay rate of the job. For `SALARY` pay types, Square calculates the hourly rate based on
    `annual_rate` and `weekly_hours`.
    """

    annual_rate: typing.Optional[Money] = pydantic.Field(default=None)
    """
    The total pay amount for a 12-month period on the job. Set if the job `PayType` is `SALARY`.
    """

    weekly_hours: typing.Optional[int] = pydantic.Field(default=None)
    """
    The planned hours per week for the job. Set if the job `PayType` is `SALARY`.
    """

    job_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the [job](entity:Job).
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
