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

from __future__ import annotations
from typing import List
from .utils.json_map import JsonMap
from .base import BaseModel
from .contract_type_enum import ContractTypeEnum
from .contract_status_enum import ContractStatusEnum
from .seniority import Seniority
from .contract_who_reports_enum import ContractWhoReportsEnum
from .client_of_contract import ClientOfContract
from .worker_of_contract import WorkerOfContract
from .invitations_of_basic_contract import InvitationsOfBasicContract
from .signatures_of_contract import SignaturesOfContract
from .compensation_details_of_contract import CompensationDetailsOfContract
from .employment_details_of_contract import EmploymentDetailsOfContract
from .contract_template import ContractTemplate
from .contract_custom_field import ContractCustomField
from .eor_quote_base import EorQuoteBase


@JsonMap({"id_": "id", "type_": "type"})
class Contract(BaseModel):
    """Contract

    :param id_: id_
    :type id_: str
    :param title: title
    :type title: str
    :param type_: Type of a contract
    :type type_: ContractTypeEnum
    :param status: Status of a contract in Deel workflow
    :type status: ContractStatusEnum
    :param created_at: Long date-time format following ISO-8601
    :type created_at: str
    :param job_title: job_title, defaults to None
    :type job_title: str, optional
    :param seniority: Seniority describes level of expertise at a job e.g. junior
    :type seniority: Seniority
    :param who_reports: Flag to indicate who is supposed to provide regular reports, defaults to None
    :type who_reports: ContractWhoReportsEnum, optional
    :param scope_of_work: scope_of_work, defaults to None
    :type scope_of_work: str, optional
    :param start_date: Long date-time format following ISO-8601
    :type start_date: str
    :param termination_date: Long date-time format following ISO-8601
    :type termination_date: str
    :param special_clause: special_clause
    :type special_clause: str
    :param is_archived: is_archived
    :type is_archived: bool
    :param client: client
    :type client: ClientOfContract
    :param worker: worker
    :type worker: WorkerOfContract
    :param invitations: invitations
    :type invitations: InvitationsOfBasicContract
    :param signatures: signatures
    :type signatures: SignaturesOfContract
    :param compensation_details: compensation_details
    :type compensation_details: CompensationDetailsOfContract
    :param employment_details: employment_details
    :type employment_details: EmploymentDetailsOfContract
    :param notice_period: Days before to notice the termination of contract for eather party., defaults to None
    :type notice_period: float, optional
    :param contract_template: Contract template details., defaults to None
    :type contract_template: ContractTemplate, optional
    :param custom_fields: custom_fields, defaults to None
    :type custom_fields: List[ContractCustomField], optional
    :param quote: EOR quote approved by Deel, defaults to None
    :type quote: EorQuoteBase, optional
    :param external_id: A unique identifier for the object provided by an external system., defaults to None
    :type external_id: str, optional
    """

    def __init__(
        self,
        id_: str,
        title: str,
        type_: ContractTypeEnum,
        status: ContractStatusEnum,
        created_at: str,
        seniority: Seniority,
        start_date: str,
        termination_date: str,
        special_clause: str,
        is_archived: bool,
        client: ClientOfContract,
        worker: WorkerOfContract,
        invitations: InvitationsOfBasicContract,
        signatures: SignaturesOfContract,
        compensation_details: CompensationDetailsOfContract,
        employment_details: EmploymentDetailsOfContract,
        job_title: str = None,
        who_reports: ContractWhoReportsEnum = None,
        scope_of_work: str = None,
        notice_period: float = None,
        contract_template: ContractTemplate = None,
        custom_fields: List[ContractCustomField] = None,
        quote: EorQuoteBase = None,
        external_id: str = None,
    ):
        self.id_ = id_
        self.title = title
        self.type_ = self._enum_matching(type_, ContractTypeEnum.list(), "type_")
        self.status = self._enum_matching(status, ContractStatusEnum.list(), "status")
        self.created_at = created_at
        if job_title is not None:
            self.job_title = job_title
        self.seniority = self._define_object(seniority, Seniority)
        if who_reports is not None:
            self.who_reports = self._enum_matching(
                who_reports, ContractWhoReportsEnum.list(), "who_reports"
            )
        if scope_of_work is not None:
            self.scope_of_work = scope_of_work
        self.start_date = start_date
        self.termination_date = termination_date
        self.special_clause = special_clause
        self.is_archived = is_archived
        self.client = self._define_object(client, ClientOfContract)
        self.worker = self._define_object(worker, WorkerOfContract)
        self.invitations = self._define_object(invitations, InvitationsOfBasicContract)
        self.signatures = self._define_object(signatures, SignaturesOfContract)
        self.compensation_details = self._define_object(
            compensation_details, CompensationDetailsOfContract
        )
        self.employment_details = self._define_object(
            employment_details, EmploymentDetailsOfContract
        )
        if notice_period is not None:
            self.notice_period = notice_period
        if contract_template is not None:
            self.contract_template = self._define_object(
                contract_template, ContractTemplate
            )
        if custom_fields is not None:
            self.custom_fields = self._define_list(custom_fields, ContractCustomField)
        if quote is not None:
            self.quote = self._define_object(quote, EorQuoteBase)
        if external_id is not None:
            self.external_id = external_id
