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

from enum import Enum
from .utils.json_map import JsonMap
from .base import BaseModel


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

    :cvar FREE_CANCELLATION: "FREE_CANCELLATION"
    :vartype FREE_CANCELLATION: str
    :cvar NON_REFUNDABLE: "NON_REFUNDABLE"
    :vartype NON_REFUNDABLE: str
    :cvar SPECIAL_CONDITIONS: "SPECIAL_CONDITIONS"
    :vartype SPECIAL_CONDITIONS: str
    """

    FREE_CANCELLATION = "FREE_CANCELLATION"
    NON_REFUNDABLE = "NON_REFUNDABLE"
    SPECIAL_CONDITIONS = "SPECIAL_CONDITIONS"

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

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


@JsonMap({"type_": "type"})
class CancellationDto(BaseModel):
    """The cancellation policy for this product.

    :param free_cancellation_until: Until when the order for this product can be cancelled for free., defaults to None
    :type free_cancellation_until: str, optional
    :param type_: The cancellation scheme supported by this product., defaults to None
    :type type_: Type, optional
    """

    def __init__(self, free_cancellation_until: str = None, type_: Type = None):
        if free_cancellation_until is not None:
            self.free_cancellation_until = free_cancellation_until
        if type_ is not None:
            self.type_ = self._enum_matching(type_, Type.list(), "type_")
