# 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 .contract_type_enum_for_estimate import ContractTypeEnumForEstimate
from .work_statement_cycle_scale_enum import WorkStatementCycleScaleEnum
from .work_statement_cycle_end_type_enum import WorkStatementCycleEndTypeEnum
from .work_statement_payment_due_type_enum import WorkStatementPaymentDueTypeEnum
from .week_days_enum import WeekDaysEnum


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

    :cvar CUSTOM_AMOUNT: "CUSTOM_AMOUNT"
    :vartype CUSTOM_AMOUNT: str
    :cvar WORK_DAYS: "WORK_DAYS"
    :vartype WORK_DAYS: str
    :cvar CALENDAR_DAYS: "CALENDAR_DAYS"
    :vartype CALENDAR_DAYS: str
    :cvar FULL_AMOUNT: "FULL_AMOUNT"
    :vartype FULL_AMOUNT: str
    """

    CUSTOM_AMOUNT = "CUSTOM_AMOUNT"
    WORK_DAYS = "WORK_DAYS"
    CALENDAR_DAYS = "CALENDAR_DAYS"
    FULL_AMOUNT = "FULL_AMOUNT"

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

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


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

    :param amount: Amount to be paid. Must be a positive number., defaults to None
    :type amount: float, optional
    :param currency_code: currency_code, defaults to None
    :type currency_code: str, optional
    :param scale: Scale of the invoice cycle., defaults to None
    :type scale: WorkStatementCycleScaleEnum, optional
    :param cycle_end: Date invoice cycle ends., defaults to None
    :type cycle_end: float, optional
    :param cycle_end_type: Cycle end can be weekly 1-7 (Monday = 1) or monthly 1-31., defaults to None
    :type cycle_end_type: WorkStatementCycleEndTypeEnum, optional
    :param payment_due_type: Type of payment due. If the payment is due on the last day of month, enter 'WITHIN_MONTH'., defaults to None
    :type payment_due_type: WorkStatementPaymentDueTypeEnum, optional
    :param payment_due_days: payment_due_days, defaults to None
    :type payment_due_days: float, optional
    :param calculation_type: Either works days or calendar days, defaults to None
    :type calculation_type: CompensationDetailsCalculationType, optional
    :param work_week_start: Days of the week., defaults to None
    :type work_week_start: WeekDaysEnum, optional
    :param work_week_end: Days of the week., defaults to None
    :type work_week_end: WeekDaysEnum, optional
    """

    def __init__(
        self,
        amount: float = None,
        currency_code: str = None,
        scale: WorkStatementCycleScaleEnum = None,
        cycle_end: float = None,
        cycle_end_type: WorkStatementCycleEndTypeEnum = None,
        payment_due_type: WorkStatementPaymentDueTypeEnum = None,
        payment_due_days: float = None,
        calculation_type: CompensationDetailsCalculationType = None,
        work_week_start: WeekDaysEnum = None,
        work_week_end: WeekDaysEnum = None,
    ):
        if amount is not None:
            self.amount = amount
        if currency_code is not None:
            self.currency_code = self._pattern_matching(
                currency_code, "^[A-Z]{3}$", "currency_code"
            )
        if scale is not None:
            self.scale = self._enum_matching(
                scale, WorkStatementCycleScaleEnum.list(), "scale"
            )
        if cycle_end is not None:
            self.cycle_end = cycle_end
        if cycle_end_type is not None:
            self.cycle_end_type = self._enum_matching(
                cycle_end_type, WorkStatementCycleEndTypeEnum.list(), "cycle_end_type"
            )
        if payment_due_type is not None:
            self.payment_due_type = self._enum_matching(
                payment_due_type,
                WorkStatementPaymentDueTypeEnum.list(),
                "payment_due_type",
            )
        if payment_due_days is not None:
            self.payment_due_days = payment_due_days
        if calculation_type is not None:
            self.calculation_type = self._enum_matching(
                calculation_type,
                CompensationDetailsCalculationType.list(),
                "calculation_type",
            )
        if work_week_start is not None:
            self.work_week_start = self._enum_matching(
                work_week_start, WeekDaysEnum.list(), "work_week_start"
            )
        if work_week_end is not None:
            self.work_week_end = self._enum_matching(
                work_week_end, WeekDaysEnum.list(), "work_week_end"
            )


@JsonMap({"type_": "type"})
class EstimateFirstPayment(BaseModel):
    """Details of pro rata payment to create.

    :param type_: Type of a contract
    :type type_: ContractTypeEnumForEstimate
    :param country_code: Country code.
    :type country_code: str
    :param start_date: Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31.
    :type start_date: str
    :param compensation_details: compensation_details
    :type compensation_details: EstimateFirstPaymentCompensationDetails
    """

    def __init__(
        self,
        type_: ContractTypeEnumForEstimate,
        country_code: str,
        start_date: str,
        compensation_details: EstimateFirstPaymentCompensationDetails,
    ):
        self.type_ = self._enum_matching(
            type_, ContractTypeEnumForEstimate.list(), "type_"
        )
        self.country_code = self._pattern_matching(
            country_code, "^[A-Z]{2}$", "country_code"
        )
        self.start_date = start_date
        self.compensation_details = self._define_object(
            compensation_details, EstimateFirstPaymentCompensationDetails
        )
