# 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 .week_days_enum import WeekDaysEnum


class ProRataCalculationType(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, ProRataCalculationType._member_map_.values())
        )


@JsonMap({})
class ProRata(BaseModel):
    """Details of the pro rata for the first payment

    :param calculation_type: Either works days or calendar days, defaults to None
    :type calculation_type: ProRataCalculationType, optional
    :param rate: Rate to be paid., defaults to None
    :type rate: float, optional
    :param daily_rate: Daily rate to be paid., defaults to None
    :type daily_rate: float, optional
    :param total: Total to be paid., defaults to None
    :type total: float, optional
    :param cycle_work_days: Total days to be work., defaults to None
    :type cycle_work_days: float, 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
    :param cycle_start: Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31., defaults to None
    :type cycle_start: str, optional
    :param cycle_end: Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31., defaults to None
    :type cycle_end: str, optional
    """

    def __init__(
        self,
        calculation_type: ProRataCalculationType = None,
        rate: float = None,
        daily_rate: float = None,
        total: float = None,
        cycle_work_days: float = None,
        work_week_start: WeekDaysEnum = None,
        work_week_end: WeekDaysEnum = None,
        cycle_start: str = None,
        cycle_end: str = None,
    ):
        if calculation_type is not None:
            self.calculation_type = self._enum_matching(
                calculation_type, ProRataCalculationType.list(), "calculation_type"
            )
        if rate is not None:
            self.rate = rate
        if daily_rate is not None:
            self.daily_rate = daily_rate
        if total is not None:
            self.total = total
        if cycle_work_days is not None:
            self.cycle_work_days = cycle_work_days
        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"
            )
        if cycle_start is not None:
            self.cycle_start = cycle_start
        if cycle_end is not None:
            self.cycle_end = cycle_end
