# This file was generated by liblab | https://liblab.com/

from enum import Enum
from .utils.json_map import JsonMap
from .base import BaseModel


class HrisContractPartTimeEmploymentType(Enum):
    """An enumeration representing different categories.

    :cvar PART_TIME: "PART_TIME"
    :vartype PART_TIME: str
    """

    PART_TIME = "PART_TIME"

    def list():
        """Lists all category values.

        :return: A list of all category values.
        :rtype: list
        """
        return list(
            map(
                lambda x: x.value,
                HrisContractPartTimeEmploymentType._member_map_.values(),
            )
        )


@JsonMap({})
class HrisContractPartTime(BaseModel):
    """HrisContractPartTime

    :param contract_oid: The Hris Direct employee contract ID
    :type contract_oid: str
    :param start_date: Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31.
    :type start_date: str
    :param employee_number: employee_number, defaults to None
    :type employee_number: float, optional
    :param end_date: Short date in format ISO-8601 (YYYY-MM-DD). For example 2022-12-31., defaults to None
    :type end_date: str, optional
    :param employment_type: employment_type
    :type employment_type: HrisContractPartTimeEmploymentType
    :param part_time_percentage: required if employmentType is "PART_TIME"
    :type part_time_percentage: float
    """

    def __init__(
        self,
        contract_oid: str,
        start_date: str,
        employment_type: HrisContractPartTimeEmploymentType,
        part_time_percentage: float,
        employee_number: float = None,
        end_date: str = None,
    ):
        self.contract_oid = contract_oid
        self.start_date = start_date
        if employee_number is not None:
            self.employee_number = employee_number
        if end_date is not None:
            self.end_date = self._pattern_matching(
                end_date, "^\d{4}-\d{2}-\d{2}$", "end_date"
            )
        self.employment_type = self._enum_matching(
            employment_type,
            HrisContractPartTimeEmploymentType.list(),
            "employment_type",
        )
        self.part_time_percentage = part_time_percentage
