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

from __future__ import annotations
from enum import Enum
from typing import Union
from .utils.json_map import JsonMap
from .base import BaseModel
from .base import OneOfBaseModel
from .contract_who_reports_enum import ContractWhoReportsEnum
from .meta_data_of_contract_to_create import MetaDataOfContractToCreate
from .compensation_details_of_contract_to_create_shared import (
    CompensationDetailsOfContractToCreateShared,
)
from .identifier_value import IdentifierValue, IdentifierValueGuard


@JsonMap({"id_": "id"})
class ClientLegalEntity7(BaseModel):
    """Choose the Deel legal entity for this contract. Use legal entity endpoint to retrieve a list of legal entities in your organization.

    :param id_: id_
    :type id_: IdentifierValue
    """

    def __init__(self, id_: IdentifierValue):
        self.id_ = IdentifierValueGuard.return_one_of(id_)


@JsonMap({"id_": "id"})
class ClientTeam4(BaseModel):
    """Choose the Deel team for this contract. Use teams endpoint to retrieve a list of teams in your organization.

    :param id_: id_
    :type id_: IdentifierValue
    """

    def __init__(self, id_: IdentifierValue):
        self.id_ = IdentifierValueGuard.return_one_of(id_)


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

    :param legal_entity: Choose the Deel legal entity for this contract. Use legal entity endpoint to retrieve a list of legal entities in your organization.
    :type legal_entity: ClientLegalEntity7
    :param team: Choose the Deel team for this contract. Use teams endpoint to retrieve a list of teams in your organization.
    :type team: ClientTeam4
    """

    def __init__(self, legal_entity: ClientLegalEntity7, team: ClientTeam4):
        self.legal_entity = self._define_object(legal_entity, ClientLegalEntity7)
        self.team = self._define_object(team, ClientTeam4)


@JsonMap({"id_": "id"})
class ContractToCreatePaygMilestonesJobTitle(BaseModel):
    """Worker's job title. You can enter a custom job title or use a pre-defiled job title using the Id retrieved in job-titles endpoint.

    :param id_: Job title ID., defaults to None
    :type id_: str, optional
    :param name: Job title. Please leave it blank when entering an Id., defaults to None
    :type name: str, optional
    """

    def __init__(self, id_: str = None, name: str = None):
        if id_ is not None:
            self.id_ = id_
        if name is not None:
            self.name = name


class SeniorityId3Guard(OneOfBaseModel):
    class_list = {"float": float, "str": str}


SeniorityId3 = Union[float, str]


@JsonMap({"id_": "id"})
class ContractToCreatePaygMilestonesSeniority(BaseModel):
    """Job seniority level. Please use the seniority levels endpoint to retrieve the list of seniority levels.

    :param id_: Seniority ID., defaults to None
    :type id_: SeniorityId3, optional
    """

    def __init__(self, id_: SeniorityId3 = None):
        if id_ is not None:
            self.id_ = SeniorityId3Guard.return_one_of(id_)


@JsonMap({})
class ContractToCreatePaygMilestonesWorker(BaseModel):
    """Worker properties

    :param expected_email: Worker's email address.
    :type expected_email: str
    :param first_name: Worker's first name
    :type first_name: str
    :param last_name: Worker's last name, defaults to None
    :type last_name: str, optional
    """

    def __init__(self, expected_email: str, first_name: str, last_name: str = None):
        self.expected_email = expected_email
        self.first_name = first_name
        if last_name is not None:
            self.last_name = last_name


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

    :cvar PAYG_MILESTONES: "payg_milestones"
    :vartype PAYG_MILESTONES: str
    """

    PAYG_MILESTONES = "payg_milestones"

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

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


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

    :param title: The title of the contract.
    :type title: str
    :param country_code: Country code., defaults to None
    :type country_code: str, optional
    :param state_code: The state or province code. Use country lookup endpoint to retrieve state codes., defaults to None
    :type state_code: str, optional
    :param scope_of_work: Describe the work to be performed., defaults to None
    :type scope_of_work: str, optional
    :param special_clause: Enter any special clause you may have., defaults to None
    :type special_clause: str, optional
    :param termination_date: Short date in format ISO-8601 (YYYY-MM-DD). For example 2022-12-31., defaults to None
    :type termination_date: str, optional
    :param client: client
    :type client: ContractToCreatePaygMilestonesClient
    :param job_title: Worker's job title. You can enter a custom job title or use a pre-defiled job title using the Id retrieved in job-titles endpoint.
    :type job_title: ContractToCreatePaygMilestonesJobTitle
    :param seniority: Job seniority level. Please use the seniority levels endpoint to retrieve the list of seniority levels., defaults to None
    :type seniority: ContractToCreatePaygMilestonesSeniority, optional
    :param notice_period: Days before to notice the termination of contract for eather party., defaults to None
    :type notice_period: float, optional
    :param who_reports: Flag to indicate who is supposed to provide regular reports, defaults to None
    :type who_reports: ContractWhoReportsEnum, optional
    :param meta: Additional custom info about a contract
    :type meta: MetaDataOfContractToCreate
    :param external_id: External Id., defaults to None
    :type external_id: str, optional
    :param worker: Worker properties, defaults to None
    :type worker: ContractToCreatePaygMilestonesWorker, optional
    :param type_: type_
    :type type_: ContractToCreatePaygMilestonesType
    :param start_date: Short date in format ISO-8601 (YYYY-MM-DD). For example 2022-12-31., defaults to None
    :type start_date: str, optional
    :param compensation_details: compensation_details
    :type compensation_details: CompensationDetailsOfContractToCreateShared
    """

    def __init__(
        self,
        title: str,
        client: ContractToCreatePaygMilestonesClient,
        job_title: ContractToCreatePaygMilestonesJobTitle,
        meta: MetaDataOfContractToCreate,
        type_: ContractToCreatePaygMilestonesType,
        compensation_details: CompensationDetailsOfContractToCreateShared,
        country_code: str = None,
        state_code: str = None,
        scope_of_work: str = None,
        special_clause: str = None,
        termination_date: str = None,
        seniority: ContractToCreatePaygMilestonesSeniority = None,
        notice_period: float = None,
        who_reports: ContractWhoReportsEnum = None,
        external_id: str = None,
        worker: ContractToCreatePaygMilestonesWorker = None,
        start_date: str = None,
    ):
        self.title = title
        if country_code is not None:
            self.country_code = self._pattern_matching(
                country_code, "^[A-Z]{2}$", "country_code"
            )
        if state_code is not None:
            self.state_code = state_code
        if scope_of_work is not None:
            self.scope_of_work = scope_of_work
        if special_clause is not None:
            self.special_clause = special_clause
        if termination_date is not None:
            self.termination_date = termination_date
        self.client = self._define_object(client, ContractToCreatePaygMilestonesClient)
        self.job_title = self._define_object(
            job_title, ContractToCreatePaygMilestonesJobTitle
        )
        if seniority is not None:
            self.seniority = self._define_object(
                seniority, ContractToCreatePaygMilestonesSeniority
            )
        if notice_period is not None:
            self.notice_period = notice_period
        if who_reports is not None:
            self.who_reports = self._enum_matching(
                who_reports, ContractWhoReportsEnum.list(), "who_reports"
            )
        self.meta = self._define_object(meta, MetaDataOfContractToCreate)
        if external_id is not None:
            self.external_id = external_id
        if worker is not None:
            self.worker = self._define_object(
                worker, ContractToCreatePaygMilestonesWorker
            )
        self.type_ = self._enum_matching(
            type_, ContractToCreatePaygMilestonesType.list(), "type_"
        )
        if start_date is not None:
            self.start_date = start_date
        self.compensation_details = self._define_object(
            compensation_details, CompensationDetailsOfContractToCreateShared
        )
