# Code generated by Lark OpenAPI.

from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.construct import init
from .rich_text import RichText


class Text(object):
    _types = {
        "text": str,
        "font_weight": str,
        "font_size": int,
        "horizontal_align": str,
        "vertical_align": str,
        "text_color": str,
        "text_background_color": str,
        "line_through": bool,
        "underline": bool,
        "italic": bool,
        "angle": int,
        "theme_text_color_code": int,
        "theme_text_background_color_code": int,
        "rich_text": RichText,
        "text_color_type": int,
        "text_background_color_type": int,
    }

    def __init__(self, d=None):
        self.text: Optional[str] = None
        self.font_weight: Optional[str] = None
        self.font_size: Optional[int] = None
        self.horizontal_align: Optional[str] = None
        self.vertical_align: Optional[str] = None
        self.text_color: Optional[str] = None
        self.text_background_color: Optional[str] = None
        self.line_through: Optional[bool] = None
        self.underline: Optional[bool] = None
        self.italic: Optional[bool] = None
        self.angle: Optional[int] = None
        self.theme_text_color_code: Optional[int] = None
        self.theme_text_background_color_code: Optional[int] = None
        self.rich_text: Optional[RichText] = None
        self.text_color_type: Optional[int] = None
        self.text_background_color_type: Optional[int] = None
        init(self, d, self._types)

    @staticmethod
    def builder() -> "TextBuilder":
        return TextBuilder()


class TextBuilder(object):
    def __init__(self) -> None:
        self._text = Text()

    def text(self, text: str) -> "TextBuilder":
        self._text.text = text
        return self

    def font_weight(self, font_weight: str) -> "TextBuilder":
        self._text.font_weight = font_weight
        return self

    def font_size(self, font_size: int) -> "TextBuilder":
        self._text.font_size = font_size
        return self

    def horizontal_align(self, horizontal_align: str) -> "TextBuilder":
        self._text.horizontal_align = horizontal_align
        return self

    def vertical_align(self, vertical_align: str) -> "TextBuilder":
        self._text.vertical_align = vertical_align
        return self

    def text_color(self, text_color: str) -> "TextBuilder":
        self._text.text_color = text_color
        return self

    def text_background_color(self, text_background_color: str) -> "TextBuilder":
        self._text.text_background_color = text_background_color
        return self

    def line_through(self, line_through: bool) -> "TextBuilder":
        self._text.line_through = line_through
        return self

    def underline(self, underline: bool) -> "TextBuilder":
        self._text.underline = underline
        return self

    def italic(self, italic: bool) -> "TextBuilder":
        self._text.italic = italic
        return self

    def angle(self, angle: int) -> "TextBuilder":
        self._text.angle = angle
        return self

    def theme_text_color_code(self, theme_text_color_code: int) -> "TextBuilder":
        self._text.theme_text_color_code = theme_text_color_code
        return self

    def theme_text_background_color_code(self, theme_text_background_color_code: int) -> "TextBuilder":
        self._text.theme_text_background_color_code = theme_text_background_color_code
        return self

    def rich_text(self, rich_text: RichText) -> "TextBuilder":
        self._text.rich_text = rich_text
        return self

    def text_color_type(self, text_color_type: int) -> "TextBuilder":
        self._text.text_color_type = text_color_type
        return self

    def text_background_color_type(self, text_background_color_type: int) -> "TextBuilder":
        self._text.text_background_color_type = text_background_color_type
        return self

    def build(self) -> "Text":
        return self._text
