# generated by datamodel-codegen:
#   filename:  employment.yaml

from __future__ import annotations

from enum import Enum
from typing import Annotated, Any, Dict, List

from pendulum import Date, DateTime
from pydantic import Field
from pydantic_extra_types.pendulum_dt import Date, DateTime

from ..v2 import MyEmploymentBaseModel


class Type(str, Enum):
    UNSPECIFIED = "UNSPECIFIED"
    INTERNAL = "INTERNAL"
    EXTERNAL = "EXTERNAL"


class Status(str, Enum):
    ACTIVE = "ACTIVE"
    INACTIVE = "INACTIVE"
    ONBOARDING = "ONBOARDING"
    LEAVE = "LEAVE"
    UNSPECIFIED = "UNSPECIFIED"


class Position(MyEmploymentBaseModel):
    title: str | None = None
    """
    The title of the position.
    """


class Supervisor(MyEmploymentBaseModel):
    id: str | None = None
    """
    The unique identifier for the supervisor.
    """


class Office(MyEmploymentBaseModel):
    id: str | None = None
    """
    The unique identifier for the office.
    """


class OrgUnit(MyEmploymentBaseModel):
    type: str | None = None
    """
    The type of the Org Unit, e.g. team or department.
    """
    id: str | None = None
    """
    The internal ID of the Org Unit.
    """


class Person(MyEmploymentBaseModel):
    id: str | None = None
    """
    The unique identifier for the person.
    """


class Type1(str, Enum):
    UNSPECIFIED = "UNSPECIFIED"
    EMPLOYEE = "EMPLOYEE"
    FIRED = "FIRED"
    DEATH = "DEATH"
    CONTRACT_EXPIRED = "CONTRACT_EXPIRED"
    AGREEMENT = "AGREEMENT"
    SUB_COMPANY_SWITCH = "SUB_COMPANY_SWITCH"
    IRREVOCABLE_SUSPENSION = "IRREVOCABLE_SUSPENSION"
    CANCELLATION = "CANCELLATION"
    COLLECTIVE_AGREEMENT = "COLLECTIVE_AGREEMENT"
    SETTLEMENT_AGREEMENT = "SETTLEMENT_AGREEMENT"
    RETIREMENT = "RETIREMENT"
    COURT_SETTLEMENT = "COURT_SETTLEMENT"
    QUIT = "QUIT"


class Termination(MyEmploymentBaseModel):
    termination_date: Date | None = None
    """
    The termination date.
    """
    last_working_day: Date | None = None
    """
    The last working day date.
    """
    terminated_at: Date | None = None
    """
    The date on which an employee submits their resignation or the employer issues a termination notice.
    """
    type: Type1 | None = None
    """
    The type of termination.
    """
    reason: str | None = None
    """
    The reason of the termination.
    """


class CostCenter(MyEmploymentBaseModel):
    id: str | None = None
    """
    The unique identifier for the cost center.
    """
    weight: float | None = None
    """
    The weight of the cost center.
    """


class LegalEntity(MyEmploymentBaseModel):
    id: str | None = None
    """
    The unique identifier for the employment legal entity.
    """


class SubCompany(MyEmploymentBaseModel):
    id: str | None = None
    """
    The unique identifier for the employment sub-company.
    """


class Meta(MyEmploymentBaseModel):
    links: Dict[str, Any] | None = None
    """
    Additional metadata links.
    """


class Employment(MyEmploymentBaseModel):
    id: str
    """
    The unique identifier for the employment.
    """
    position: Position | None = None
    weekly_working_hours: float | None = None
    """
    The total amount of weekly working hours.
    """
    full_time_weekly_working_hours: float | None = None
    """
    The number of hours per week that is considered full time for the employment.
    """
    probation_end_date: Date | None = None
    """
    The date that marks the end of the probation period.
    """
    employment_start_date: Date | None = None
    """
    The date that marks the start of the employment.
    """
    employment_end_date: Date | None = None
    """
    The date that marks the end of the employment.
    """
    type: Type | None = None
    """
    The employment type.
    """
    contract_end_date: Date | None = None
    """
    The date the contract ends for this employment.
    """
    created_at: DateTime
    """
    The date and time this employment was created in Personio.
    """
    updated_at: DateTime
    """
    The date and time this employment was last updated in Personio.
    """
    supervisor: Any | Supervisor | None = None
    person: Person
    office: Office | None = None
    org_units: List[OrgUnit] | None = None
    """
    All Org Units, i.e. department and team, directly associated with the employment.
    """
    termination: Termination | None = None
    cost_centers: List[CostCenter] | None = None
    """
    The list of cost centers this employment is attached to.
    """
    legal_entity: LegalEntity | None = None
    sub_company: SubCompany | None = None
    status: Status | None = None
    """
    The status of the employment.
    """
    field_meta: Annotated[Meta | None, Field(alias="_meta")] = None
