# 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 .payment_method import PaymentMethod
from .payment_status_enum import PaymentStatusEnum
from .payment_worker import PaymentWorker


@JsonMap({"id_": "id"})
class Payment(BaseModel):
    """Payment

    :param id_: Unique identifier of the payment.
    :type id_: float
    :param payment_method: payment_method
    :type payment_method: PaymentMethod
    :param status: status of payment
    :type status: PaymentStatusEnum
    :param payment_currency: Currency code.
    :type payment_currency: str
    :param label: label
    :type label: str
    :param paid_at: Long date-time format following ISO-8601
    :type paid_at: str
    :param created_at: Long date-time format following ISO-8601
    :type created_at: str
    :param total: Total paid.
    :type total: str
    :param workers: workers
    :type workers: List[PaymentWorker]
    """

    def __init__(
        self,
        id_: float,
        payment_method: PaymentMethod,
        status: PaymentStatusEnum,
        payment_currency: str,
        label: str,
        paid_at: str,
        created_at: str,
        total: str,
        workers: List[PaymentWorker],
    ):
        self.id_ = id_
        self.payment_method = self._define_object(payment_method, PaymentMethod)
        self.status = self._enum_matching(status, PaymentStatusEnum.list(), "status")
        self.payment_currency = self._pattern_matching(
            payment_currency, "^[A-Z]{3}$", "payment_currency"
        )
        self.label = label
        self.paid_at = paid_at
        self.created_at = created_at
        self.total = total
        self.workers = self._define_list(workers, PaymentWorker)
