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

from enum import Enum
from typing import Union
from typing import List
from .utils.json_map import JsonMap
from .base import BaseModel
from .base import OneOfBaseModel


@JsonMap({})
class Data11(BaseModel):
    """Text type

    :param value: value, defaults to None
    :type value: str, optional
    """

    def __init__(self, value: str = None):
        if value is not None:
            self.value = value


@JsonMap({})
class Data21(BaseModel):
    """Number type

    :param value: value, defaults to None
    :type value: float, optional
    """

    def __init__(self, value: float = None):
        if value is not None:
            self.value = value


@JsonMap({})
class Data31(BaseModel):
    """Date type: YYYY-MM-DD

    :param value: value, defaults to None
    :type value: str, optional
    """

    def __init__(self, value: str = None):
        if value is not None:
            self.value = value


@JsonMap({})
class Data41(BaseModel):
    """Percentage type

    :param text: text, defaults to None
    :type text: str, optional
    :param value: value, defaults to None
    :type value: float, optional
    """

    def __init__(self, text: str = None, value: float = None):
        if text is not None:
            self.text = text
        if value is not None:
            self.value = value


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

    :cvar USD: "USD"
    :vartype USD: str
    :cvar EUR: "EUR"
    :vartype EUR: str
    :cvar JPY: "JPY"
    :vartype JPY: str
    :cvar GBP: "GBP"
    :vartype GBP: str
    :cvar AUD: "AUD"
    :vartype AUD: str
    :cvar CAD: "CAD"
    :vartype CAD: str
    :cvar CHF: "CHF"
    :vartype CHF: str
    :cvar CNY: "CNY"
    :vartype CNY: str
    :cvar SEK: "SEK"
    :vartype SEK: str
    :cvar NZD: "NZD"
    :vartype NZD: str
    :cvar BRL: "BRL"
    :vartype BRL: str
    """

    USD = "USD"
    EUR = "EUR"
    JPY = "JPY"
    GBP = "GBP"
    AUD = "AUD"
    CAD = "CAD"
    CHF = "CHF"
    CNY = "CNY"
    SEK = "SEK"
    NZD = "NZD"
    BRL = "BRL"

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

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


@JsonMap({})
class Data51(BaseModel):
    """Currency type

    :param amount: amount, defaults to None
    :type amount: float, optional
    :param currency: The currency code in ISO 4217 format, defaults to None
    :type currency: Data5Currency1, optional
    """

    def __init__(self, amount: float = None, currency: Data5Currency1 = None):
        if amount is not None:
            self.amount = amount
        if currency is not None:
            self.currency = self._enum_matching(
                currency, Data5Currency1.list(), "currency"
            )


@JsonMap({})
class Data61(BaseModel):
    """List type

    :param option: option, defaults to None
    :type option: str, optional
    """

    def __init__(self, option: str = None):
        if option is not None:
            self.option = option


@JsonMap({})
class Data71(BaseModel):
    """Multiselect type

    :param options: options, defaults to None
    :type options: List[str], optional
    """

    def __init__(self, options: List[str] = None):
        if options is not None:
            self.options = options


class DataDataGuard(OneOfBaseModel):
    class_list = {
        "Data11": Data11,
        "Data21": Data21,
        "Data31": Data31,
        "Data41": Data41,
        "Data51": Data51,
        "Data61": Data61,
        "Data71": Data71,
    }


DataData = Union[Data11, Data21, Data31, Data41, Data51, Data61, Data71]


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

    :cvar TEXT: "text"
    :vartype TEXT: str
    :cvar NUMBER: "number"
    :vartype NUMBER: str
    :cvar CURRENCY: "currency"
    :vartype CURRENCY: str
    :cvar DATE: "date"
    :vartype DATE: str
    :cvar PERCENTAGE: "percentage"
    :vartype PERCENTAGE: str
    :cvar LIST: "list"
    :vartype LIST: str
    :cvar MULTISELECT: "multiselect"
    :vartype MULTISELECT: str
    """

    TEXT = "text"
    NUMBER = "number"
    CURRENCY = "currency"
    DATE = "date"
    PERCENTAGE = "percentage"
    LIST = "list"
    MULTISELECT = "multiselect"

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

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


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

    :param id_: UUID for the custom field value
    :type id_: str
    :param data: data, defaults to None
    :type data: DataData, optional
    :param name: Name of the custom field
    :type name: str
    :param type_: Type of the custom field
    :type type_: DataType
    """

    def __init__(self, id_: str, name: str, type_: DataType, data: DataData = None):
        self.id_ = id_
        if data is not None:
            self.data = DataDataGuard.return_one_of(data)
        self.name = name
        self.type_ = self._enum_matching(type_, DataType.list(), "type_")


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

    :param data: data
    :type data: List[CustomFieldValuesContainerData]
    """

    def __init__(self, data: List[CustomFieldValuesContainerData]):
        self.data = self._define_list(data, CustomFieldValuesContainerData)
