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

from __future__ import annotations
from enum import Enum
from .utils.json_map import JsonMap
from .base import BaseModel
from .gp_client import GpClient
from .gp_contract_status_type_enum import GpContractStatusTypeEnum


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

    :param street: Street and number.
    :type street: str
    :param city: City name.
    :type city: str
    :param state: State code., defaults to None
    :type state: str, optional
    :param zip: Zip code.
    :type zip: str
    :param country: Country code.
    :type country: str
    """

    def __init__(
        self, street: str, city: str, zip: str, country: str, state: str = None
    ):
        self.street = street
        self.city = city
        if state is not None:
            self.state = state
        self.zip = zip
        self.country = self._pattern_matching(country, "^[A-Z]{2}$", "country")


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

    :param first_name: Employee's first name.
    :type first_name: str
    :param last_name: Employee's last name.
    :type last_name: str
    :param email: Worker's email address.
    :type email: str
    :param work_email: Worker's email address.
    :type work_email: str
    :param nationality: Employee's nationality., defaults to None
    :type nationality: str, optional
    :param employee_number: Employee's number., defaults to None
    :type employee_number: str, optional
    :param address: address
    :type address: EmployeeAddress2
    """

    def __init__(
        self,
        first_name: str,
        last_name: str,
        email: str,
        work_email: str,
        address: EmployeeAddress2,
        nationality: str = None,
        employee_number: str = None,
    ):
        self.first_name = first_name
        self.last_name = last_name
        self.email = email
        self.work_email = work_email
        if nationality is not None:
            self.nationality = nationality
        if employee_number is not None:
            self.employee_number = employee_number
        self.address = self._define_object(address, EmployeeAddress2)


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

    :param allowance: Enter the number of holidays.
    :type allowance: float
    :param start_date: Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31.
    :type start_date: str
    """

    def __init__(self, allowance: float, start_date: str):
        self.allowance = allowance
        self.start_date = start_date


@JsonMap({"type_": "type"})
class GpContractToCreateEmployment(BaseModel):
    """GpContractToCreateEmployment

    :param type_: Is it a full-time contract or a part-time contract?
    :type type_: GpContractStatusTypeEnum
    :param start_date: Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31.
    :type start_date: str
    :param holidays: holidays
    :type holidays: EmploymentHolidays1
    """

    def __init__(
        self,
        type_: GpContractStatusTypeEnum,
        start_date: str,
        holidays: EmploymentHolidays1,
    ):
        self.type_ = self._enum_matching(
            type_, GpContractStatusTypeEnum.list(), "type_"
        )
        self.start_date = start_date
        self.holidays = self._define_object(holidays, EmploymentHolidays1)


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

    :cvar YEAR: "YEAR"
    :vartype YEAR: str
    :cvar MONTH: "MONTH"
    :vartype MONTH: str
    """

    YEAR = "YEAR"
    MONTH = "MONTH"

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

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


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

    :param scale: Defines the scale at which the salary is paid.
    :type scale: Scale
    :param salary: Employee's gross annual/month salary.
    :type salary: float
    :param currency: currency, defaults to None
    :type currency: str, optional
    """

    def __init__(self, scale: Scale, salary: float, currency: str = None):
        self.scale = self._enum_matching(scale, Scale.list(), "scale")
        self.salary = salary
        if currency is not None:
            self.currency = self._pattern_matching(currency, "^[A-Z]{3}$", "currency")


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

    :param employee: employee
    :type employee: GpContractToCreateEmployee
    :param employment: employment
    :type employment: GpContractToCreateEmployment
    :param job_title: Employee's job title.
    :type job_title: str
    :param client: client
    :type client: GpClient
    :param compensation_details: compensation_details
    :type compensation_details: GpContractToCreateCompensationDetails
    """

    def __init__(
        self,
        employee: GpContractToCreateEmployee,
        employment: GpContractToCreateEmployment,
        job_title: str,
        client: GpClient,
        compensation_details: GpContractToCreateCompensationDetails,
    ):
        self.employee = self._define_object(employee, GpContractToCreateEmployee)
        self.employment = self._define_object(employment, GpContractToCreateEmployment)
        self.job_title = job_title
        self.client = self._define_object(client, GpClient)
        self.compensation_details = self._define_object(
            compensation_details, GpContractToCreateCompensationDetails
        )
