from enum import Enum
from typing import Union


class RequestType(Enum):
    GET = "get"
    POST = "post"
    DELETE = "delete"
    PATCH = "patch"
    PUT = "put"
    OPTIONS = "options"
    HEAD = "head"


class Button(Enum):

    # Buttons
    REFRESH = "refresh"
    NEW = "new"
    DELETE = "delete"

    # Buttons and Create Buttons
    SAVE = "save"
    SAVE_AND_CLOSE = "saveandclose"
    SAVE_AND_NEW = "saveandnew"

    # Create Buttons
    RESET = "reset"

    # Custom Buttons
    DROPDOWN = "dropdown"
    HYPERLINK = "hyperlink"
    WIDGET = "widget"
    ACTION = "action"

    @classmethod
    def buttons(cls):
        return [
            cls.REFRESH.value,
            cls.NEW.value,
            cls.DELETE.value,
            cls.SAVE.value,
            cls.SAVE_AND_CLOSE.value,
            cls.SAVE_AND_NEW.value,
        ]

    @classmethod
    def create_buttons(cls):
        return [
            cls.SAVE.value,
            cls.SAVE_AND_CLOSE.value,
            cls.SAVE_AND_NEW.value,
            cls.RESET.value,
        ]

    @classmethod
    def custom_buttons(cls):
        return [
            cls.DROPDOWN.value,
            cls.HYPERLINK.value,
            cls.WIDGET.value,
            cls.ACTION.value,
        ]


class WidgetType(Enum):
    LIST = "list"
    INSTANCE = "instance"
    CHART = "chart"


class Operator(Enum):
    EQUAL = "=="
    UNEQUAL = "!="
    GREATER = ">"
    GREATER_EQUAL = ">="
    LESS = "<"
    LESS_EQUAL = "<="
    EXISTS = "∃"


class Unit(Enum):
    FRACTION = "fr"
    REM = "rem"
    PIXEL = "px"

    def __call__(self, _value):
        return (float(_value), self.value)

    def unit(self, _value: Union[float, str, int]):
        assert isinstance(_value, (float, str, int)), f"_value needs to be one of str, float or int"

        return f"{float(_value)}{self.value}"


class AuthType(Enum):
    NONE = "NONE"
    JWT = "JWT"


class WBIcon(Enum):
    ACTION = "wb-icon-action"
    ARROWS_SWAP_1 = "wb-icon-arrows-swap-1"
    ARROWS_SWAP_2 = "wb-icon-arrows-swap-2"
    ARROW_DOWN = "wb-icon-arrow-down"
    ARROW_LEFT = "wb-icon-arrow-left"
    ARROW_RIGHT = "wb-icon-arrow-right"
    ARROW_UP = "wb-icon-arrow-up"
    BANK = "wb-icon-bank"
    BELL_EMPTY = "wb-icon-bell-inverted"
    BELL_FULL = "wb-icon-bell"
    BOLD = "wb-icon-bold"
    BOOKMARK = "wb-icon-bookmark"
    BOOKMARK_INVERTED = "wb-icon-bookmark-inverted"
    BULLETED_LIST = "wb-icon-bulleted-list"
    CAKE_1 = "wb-icon-cake-1"
    CAKE_2 = "wb-icon-cake-2"
    CAKE_3 = "wb-icon-cake-3"
    CALENDAR_1 = "wb-icon-calendar-1"
    CALENDAR_2 = "wb-icon-calendar-2"
    CALENDAR_3 = "wb-icon-calendar-3"
    CAMERA_1 = "wb-icon-camera-1"
    CAMERA_2 = "wb-icon-camera-2"
    CHART_BARS_1 = "wb-icon-chart-bars-1"
    CHART_BARS_2 = "wb-icon-chart-bars-2"
    CHART_BARS_3 = "wb-icon-chart-bars-3"
    CHART_BARS_4 = "wb-icon-chart-bars-4"
    CHART_LINE_2 = "wb-icon-chart-line-2"
    CHART_PIE = "wb-icon-chart-pie"
    CHART_PIRAMID = "wb-icon-chart-piramid"
    CHART_SWITCHES = "wb-icon-chart-switches"
    CIRCLE_CHECK = "wb-icon-circle-check"
    CIRCLE_EXCLAMATION = "wb-icon-circle-exclamation"
    CIRCLE_EXCLAMATION_INVERTED = "wb-icon-circle-exclamation-inverted"
    CIRCLE_NO = "wb-icon-circle-x-inverted"
    CIRCLE_QUESTION = "wb-icon-circle-question"
    CIRCLE_QUESTION_INVERTED = "wb-icon-circle-question-inverted"
    CIRCLE_X = "wb-icon-circle-x"
    CIRCLE_YES = "wb-icon-circle-check-inverted"
    CLIPBOARD_1 = "wb-icon-clipboard-1"
    CLIPBOARD_2 = "wb-icon-clipboard-2"
    CLIPBOARD_3 = "wb-icon-clipboard-3"
    CLIPBOARD_4 = "wb-icon-clipboard-4"
    CLIPBOARD_CHECKS_1 = "wb-icon-clipboard-checks-1"
    CLIPBOARD_CHECKS_2 = "wb-icon-clipboard-checks-2"
    CLOCK = "wb-icon-clock-2"
    CLOCK_1 = "wb-icon-clock-1"
    CLOCK_3 = "wb-icon-clock-3"
    CLOCK_ALARM = "wb-icon-clock-alarm"
    COG = "wb-icon-gear-6"
    CONTACT_BOOK = "wb-icon-contact-book"
    COPY_1 = "wb-icon-copy-1"
    COPY_2 = "wb-icon-copy-2"
    COPY_3 = "wb-icon-copy-3"
    COPY_4 = "wb-icon-copy-4"
    COPY_5 = "wb-icon-copy-5"
    COPY_6 = "wb-icon-copy-6"
    COPY_7 = "wb-icon-copy-7"
    COPY_FAT_1 = "wb-icon-copy-fat-1"
    COPY_FAT_2 = "wb-icon-copy-fat-2"
    COPY_FAT_3 = "wb-icon-copy-fat-3"
    COPY_FAT_4 = "wb-icon-copy-fat-4"
    COPY_FAT_5 = "wb-icon-copy-fat-5"
    CROSSHAIR = "wb-icon-crosshair"
    DASHBOARD = "wb-icon-dashboard-2"
    DASHBOARD_1 = "wb-icon-dashboard-1"
    DATA = "wb-icon-data-grid-3"
    DATA_GRID_1 = "wb-icon-data-grid-1"
    DATA_GRID_2 = "wb-icon-data-grid-2"
    DATA_GRID_4 = "wb-icon-data-grid-4"
    DATA_GRID_5 = "wb-icon-data-grid-5"
    DATA_LIST_2 = "wb-icon-data-list-2"
    DATA_LIST_3 = "wb-icon-data-list-3"
    DATA_LIST_4 = "wb-icon-data-list-4"
    DATA_LIST_5 = "wb-icon-data-list-5"
    DATA_LIST_6 = "wb-icon-data-list-6"
    DATA_LIST_7 = "wb-icon-data-list-7"
    DEDENT = "wb-icon-dedent"
    DISABLED = "wb-icon-disabled"
    DOCUMENT_1 = "wb-icon-document-1"
    DOCUMENT_2 = "wb-icon-document-2"
    DOCUMENT_BOOK = "wb-icon-document-book"
    DOCUMENT_GEAR = "wb-icon-document-gear"
    DOCUMENT_LOCK = "wb-icon-document-lock"
    DOLLAR = "wb-icon-dollar"
    EDIT_2 = "wb-icon-edit-2"
    EDIT_3 = "wb-icon-edit-3"
    ENVELOP = "wb-icon-envelope"
    ENVELOPE_OPEN_1 = "wb-icon-envelope-open-1"
    ENVELOPE_OPEN_2 = "wb-icon-envelope-open-2"
    ENVELOPE_OPEN_DOLLAR = "wb-icon-envelope-open-dollar"
    ENVELOP_EURO = "wb-icon-envelope-open-euro"
    ENVELOP_LOCK = "wb-icon-envelope-open-suitcase"
    ENVELOP_OPEN = "wb-icon-envelope-open-3"
    ENVELOP_PERSON = "wb-icon-envelope-open-person"
    EURO = "wb-icon-euro"
    EYE = "wb-icon-eye"
    EYE_CROSSED = "wb-icon-eye-crossed"
    FEMALE = "wb-icon-female"
    FILTERS_1 = "wb-icon-filters-1"
    FILTERS_2 = "wb-icon-filters-2"
    FILTERS_OFF_1 = "wb-icon-filters-off-1"
    FILTERS_OFF_2 = "wb-icon-filters-off-2"
    FILTERS_OFF_3 = "wb-icon-filters-off-3"
    FLOPPY_DISK = "wb-icon-floppy-disk"
    FLOPPY_DISK_CHECK = "wb-icon-floppy-disk-check"
    FLOPPY_DISK_X = "wb-icon-floppy-disk-x"
    FOLDER = "wb-icon-folder"
    FOLDERS = "wb-icon-folders"
    FOLDER_EURO = "wb-icon-folder-euro"
    FOLDER_INVERTED = "wb-icon-folder-inverted"
    FOLDER_PLUS = "wb-icon-folder-plus"
    FOLDER_PLUS_INVERTED = "wb-icon-folder-plus-inverted"
    FONT_COLOR = "wb-icon-font-color"
    GEAR_1 = "wb-icon-gear-1"
    GEAR_2 = "wb-icon-gear-2"
    GEAR_3 = "wb-icon-gear-3"
    GEAR_4 = "wb-icon-gear-4"
    GEAR_5 = "wb-icon-gear-5"
    GEAR_7 = "wb-icon-gear-7"
    GLOBE = "wb-icon-globe-1"
    GLOBE_2 = "wb-icon-globe-2"
    HANDSHAKE = "wb-icon-handshake"
    HANDS_EURO = "wb-icon-handshake-euro"
    HOME = "wb-icon-home"
    HOURGLASS_EMPTY = "wb-icon-hourglass-empty"
    HOURGLASS_FULL = "wb-icon-hourglass-full"
    HOURGLASS_MIDDLE = "wb-icon-hourglass-middle"
    IMAGE = "wb-icon-image"
    INDENT = "wb-icon-indent"
    INFO = "wb-icon-circle-info"
    ITALIC = "wb-icon-italic"
    LINK = "wb-icon-link"
    LOCK_CLOSED = "wb-icon-lock-closed-2"
    LOCK_CLOSED_1 = "wb-icon-lock-closed-1"
    LOCK_CLOSED_3 = "wb-icon-lock-closed-3"
    LOCK_OPEN = "wb-icon-lock-open-2"
    LOCK_OPEN_1 = "wb-icon-lock-open-1"
    LOCK_OPEN_3 = "wb-icon-lock-open-3"
    LUNCH = "wb-icon-lunch"
    MALE = "wb-icon-male"
    MAN_1 = "wb-icon-man-1"
    MAN_2 = "wb-icon-man-2"
    MAN_3 = "wb-icon-man-3"
    MAN_4 = "wb-icon-man-4"
    MAN_5 = "wb-icon-man-5"
    MAN_6 = "wb-icon-man-6"
    MAN_7 = "wb-icon-man-7"
    MAXIMIZE = "wb-icon-maximize-3"
    MAXIMIZE_1 = "wb-icon-maximize-1"
    MAXIMIZE_2 = "wb-icon-maximize-2"
    MENU = "wb-icon-data-list-1"
    MINIMIZE = "wb-icon-minimize-4"
    MINIMIZE_1 = "wb-icon-minimize-1"
    MINIMIZE_2 = "wb-icon-minimize-2"
    MINIMIZE_3 = "wb-icon-minimize-3"
    NOTEBOOK = "wb-icon-notebook"
    NOTEBOOK_INVERTED = "wb-icon-notebook-inverted"
    NUMBERED_LIST = "wb-icon-numbered-list"
    PAGE_BREAK = "wb-icon-page-break"
    PENCIL = "wb-icon-edit-1"
    PEOPLE = "wb-icon-people"
    PERSON = "wb-icon-person"
    PHONE = "wb-icon-phone"
    PHONE_CALL = "wb-icon-phone-call"
    PIN = "wb-icon-pin"
    PIPETTE_EMPTY = "wb-icon-pipette-empty"
    PIPETTE_FULL = "wb-icon-pipette-full"
    PLUS = "wb-icon-plus"
    QUOTE = "wb-icon-quote"
    RECORDER = "wb-icon-recorder"
    REDO = "wb-icon-redo"
    REFRESH_1 = "wb-icon-refresh-1"
    REFRESH_2 = "wb-icon-refresh-2"
    REFRESH_24_ACW = "wb-icon-refresh-24-acw"
    REFRESH_24_CW = "wb-icon-refresh-24-cw"
    REFRESH_3_ACW = "wb-icon-refresh-3-acw"
    REFRESH_3_CW = "wb-icon-refresh-3-cw"
    REFRESH_CLOCK = "wb-icon-refresh-clock"
    REFRESH_DOTS = "wb-icon-refresh-dots"
    REFRESH_DOTS_24 = "wb-icon-refresh-dots-24"
    REFRESH_DOTS_GEAR = "wb-icon-refresh-dots-gear"
    REFRESH_THREE = "wb-icon-refresh-three"
    REMOVE_FORMATTING = "wb-icon-remove-formatting"
    REPLACE = "wb-icon-arrows-replace"
    SCISSORS = "wb-icon-scissors"
    SEARCH = "wb-icon-search"
    SEND = "wb-icon-send"
    SICK_LEAVE_1 = "wb-icon-sick-leave-1"
    SICK_LEAVE_2 = "wb-icon-sick-leave-2"
    SICK_LEAVE_3 = "wb-icon-sick-leave-3"
    SICK_LEAVE_4 = "wb-icon-sick-leave-4"
    SHARE_1 = "wb-icon-share-1"
    SHARE_2 = "wb-icon-share-2"
    SKYPE = "wb-icon-skype"
    SORT_A_Z = "wb-icon-from-a-to-z"
    SORT_Z_A = "wb-icon-from-z-to-a"
    SOUND_OFF = "wb-icon-sound-off"
    SOUND_ON = "wb-icon-sound-on"
    SPEACH_BUBBLE = "wb-icon-speech-bubble"
    SPELL_CHECK = "wb-icon-spell-check"
    STAR = "wb-icon-star"
    STATS = "wb-icon-chart-line-1"
    STEP_BACK_2 = "wb-icon-step-back-2"
    STEP_FORWARD_2 = "wb-icon-step-forward-2"
    STEP_LEFT = "wb-icon-step-back-1"
    STEP_RIGHT = "wb-icon-step-forward-1"
    STRIKETHROUGH = "wb-icon-strikethrough"
    SUBSCRIPT = "wb-icon-subscript"
    SUITCASE_1 = "wb-icon-suitcase-1"
    SUITCASE_2 = "wb-icon-suitcase-2"
    SUPERSCRIPT = "wb-icon-superscript"
    TABLE = "wb-icon-table"
    TEXT_ALIGN_CENTER = "wb-icon-text-align-center"
    TEXT_ALIGN_JUSTIFY = "wb-icon-text-align-justify"
    TEXT_ALIGN_LEFT = "wb-icon-text-align-left"
    TEXT_ALIGN_RIGHT = "wb-icon-text-align-right"
    TEXT_BG_COLOR = "wb-icon-text-bg-color"
    THUMBS_DOWN = "wb-icon-thumb-down"
    THUMBS_UP = "wb-icon-thumb-up"
    TRADE = "wb-icon-trade"
    TRASH = "wb-icon-trashbin-2"
    TRASHBIN_1 = "wb-icon-trashbin-1"
    TRIANGLES_DOWN = "wb-icon-triangles-down"
    TRIANGLES_LEFT = "wb-icon-triangles-left"
    TRIANGLES_LEFT_STOP = "wb-icon-triangles-left-stop"
    TRIANGLES_RIGHT = "wb-icon-triangles-right"
    TRIANGLES_RIGHT_STOP = "wb-icon-triangles-right-stop"
    TRIANGLES_UP = "wb-icon-triangles-up"
    TRIANGLE_DOWN = "wb-icon-triangle-down"
    TRIANGLE_LEFT = "wb-icon-triangle-left"
    TRIANGLE_RIGHT = "wb-icon-triangle-right"
    TRIANGLE_UP = "wb-icon-triangle-up"
    UNDERLINE = "wb-icon-underline"
    UNDO = "wb-icon-undo"
    UNLINK = "wb-icon-unlink"
    WOMAN_1 = "wb-icon-woman-1"
    WOMAN_2 = "wb-icon-woman-2"
    WOMAN_3 = "wb-icon-woman-3"
    WOMAN_4 = "wb-icon-woman-4"
    WOMAN_5 = "wb-icon-woman-5"
    WOMAN_6 = "wb-icon-woman-6"
    WOMAN_7 = "wb-icon-woman-7"
    X = "wb-icon-x"
