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

from typing import Union
from .utils.json_map import JsonMap
from .base import BaseModel
from .base import OneOfBaseModel


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


AdjustmentToCreateAmount = Union[str, float]


@JsonMap({})
class AdjustmentToCreate(BaseModel):
    """Details of adjustment to create

    :param contract_id: The identifier of the contract associated with the adjustment
    :type contract_id: str
    :param amount: Amount of adjustment.
    :type amount: AdjustmentToCreateAmount
    :param date_of_adjustment: Short date in format ISO-8601 (YYYY-MM-DD). For example 2022-12-31., defaults to None
    :type date_of_adjustment: str, optional
    :param title: Title of adjustment.
    :type title: str
    :param description: Description of adjustment.
    :type description: str
    :param cycle_reference: Cycle reference of adjustment., defaults to None
    :type cycle_reference: str, optional
    :param file: File of adjustment.
    :type file: str
    :param adjustment_category_id: Adjustment category id.
    :type adjustment_category_id: str
    :param move_next_cycle: If an adjustments can belong to another payroll cycle., defaults to None
    :type move_next_cycle: bool, optional
    :param vendor: Vendor of adjustment.
    :type vendor: str
    :param country: Country code.
    :type country: str
    """

    def __init__(
        self,
        contract_id: str,
        amount: AdjustmentToCreateAmount,
        title: str,
        description: str,
        file: str,
        adjustment_category_id: str,
        vendor: str,
        country: str,
        date_of_adjustment: str = None,
        cycle_reference: str = None,
        move_next_cycle: bool = None,
    ):
        self.contract_id = contract_id
        self.amount = AdjustmentToCreateAmountGuard.return_one_of(amount)
        if date_of_adjustment is not None:
            self.date_of_adjustment = self._pattern_matching(
                date_of_adjustment, "^\d{4}-\d{2}-\d{2}$", "date_of_adjustment"
            )
        self.title = title
        self.description = description
        if cycle_reference is not None:
            self.cycle_reference = cycle_reference
        self.file = file
        self.adjustment_category_id = adjustment_category_id
        if move_next_cycle is not None:
            self.move_next_cycle = move_next_cycle
        self.vendor = vendor
        self.country = self._pattern_matching(country, "^[A-Z]{2}$", "country")
