# Path: pytablewriter/_function.py
# def normalize_enum(
#     value, enum_class: Type[Enum], validate: bool = True, default: Optional[Enum] = None
# ):
#     if value is None:
#         return default
# 
#     if isinstance(value, enum_class):
#         return value
# 
#     try:
#         return enum_class[replace_symbol(value.strip(), "_").upper()]
#     except AttributeError:
#         if validate:
#             raise TypeError(f"value must be a {enum_class} or a str: actual={type(value)}")
#     except KeyError:
#         if validate:
#             raise ValueError(
#                 "invalid valid found: expected={}, actual={}".format(
#                     "/".join(item.name for item in enum_class), value
#                 )
#             )
# 
#     return value
# 
# Path: pytablewriter/style/_font.py
# class FontSize(Enum):
#     NONE = "none"
#     TINY = "tiny"
#     SMALL = "small"
#     MEDIUM = "medium"
#     LARGE = "large"
# 
# class FontStyle(Enum):
#     NORMAL = "normal"
#     ITALIC = "italic"
# 
# class FontWeight(Enum):
#     NORMAL = "normal"
#     BOLD = "bold"


from enum import Enum, unique
from typing import Optional, Union, cast
from dataproperty import Align
from tcolorpy import Color
from .._function import normalize_enum
from ._font import FontSize, FontStyle, FontWeight



@unique
class DecorationLine(Enum):
    NONE = "none"
    LINE_THROUGH = "line_through"
    STRIKE = "strike"
    UNDERLINE = "underline"


@unique
class ThousandSeparator(Enum):
    NONE = "none"  #: no thousands separator
    COMMA = "comma"  #: ``','`` as thousands separator
    SPACE = "space"  #: ``' '`` as thousands separator
    UNDERSCORE = "underscore"  #: ``'_'`` as thousands separator


@unique
class VerticalAlign(Enum):
    BASELINE = (1 << 0, "baseline")
    TOP = (1 << 1, "top")
    MIDDLE = (1 << 2, "middle")
    BOTTOM = (1 << 3, "bottom")

    @property
    def align_code(self):
        return self.__align_code


# Path: pytablewriter/_function.py
# def normalize_enum(
#     value, enum_class: Type[Enum], validate: bool = True, default: Optional[Enum] = None
# ):
#     if value is None:
#         return default
# 
#     if isinstance(value, enum_class):
#         return value
# 
#     try:
#         return enum_class[replace_symbol(value.strip(), "_").upper()]
#     except AttributeError:
#         if validate:
#             raise TypeError(f"value must be a {enum_class} or a str: actual={type(value)}")
#     except KeyError:
#         if validate:
#             raise ValueError(
#                 "invalid valid found: expected={}, actual={}".format(
#                     "/".join(item.name for item in enum_class), value
#                 )
#             )
# 
#     return value
# 
# Path: pytablewriter/style/_font.py
# class FontSize(Enum):
#     NONE = "none"
#     TINY = "tiny"
#     SMALL = "small"
#     MEDIUM = "medium"
#     LARGE = "large"
# 
# class FontStyle(Enum):
#     NORMAL = "normal"
#     ITALIC = "italic"
# 
# class FontWeight(Enum):
#     NORMAL = "normal"
#     BOLD = "bold"


# Path: pytablewriter/style/_style.py
from enum import Enum, unique
from typing import Optional, Union, cast
from dataproperty import Align
from tcolorpy import Color
from .._function import normalize_enum
from ._font import FontSize, FontStyle, FontWeight




@unique
class DecorationLine(Enum):
    NONE = "none"
    LINE_THROUGH = "line_through"
    STRIKE = "strike"
    UNDERLINE = "underline"


@unique
class ThousandSeparator(Enum):
    NONE = "none"  #: no thousands separator
    COMMA = "comma"  #: ``','`` as thousands separator
    SPACE = "space"  #: ``' '`` as thousands separator
    UNDERSCORE = "underscore"  #: ``'_'`` as thousands separator


@unique
class VerticalAlign(Enum):
    BASELINE = (1 << 0, "baseline")
    TOP = (1 << 1, "top")
    MIDDLE = (1 << 2, "middle")
    BOTTOM = (1 << 3, "bottom")

    @property
    def align_code(self):
        return self.__align_code


    @property