# 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 .doc_chunk_table_row import DocChunkTableRow
from .table_img import TableImg


class DocChunkTableDetail(object):
    _types = {
        "table_idx": int,
        "text": str,
        "cells": List[DocChunkTableRow],
        "table_name": str,
        "caption": str,
        "md_text": str,
        "html_text": str,
        "table_img": TableImg,
        "sub_table_idx": int,
        "table_range": str,
        "header_ranges": List[str],
        "desc_ranges": List[str],
    }

    def __init__(self, d=None):
        self.table_idx: Optional[int] = None
        self.text: Optional[str] = None
        self.cells: Optional[List[DocChunkTableRow]] = None
        self.table_name: Optional[str] = None
        self.caption: Optional[str] = None
        self.md_text: Optional[str] = None
        self.html_text: Optional[str] = None
        self.table_img: Optional[TableImg] = None
        self.sub_table_idx: Optional[int] = None
        self.table_range: Optional[str] = None
        self.header_ranges: Optional[List[str]] = None
        self.desc_ranges: Optional[List[str]] = None
        init(self, d, self._types)

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


class DocChunkTableDetailBuilder(object):
    def __init__(self) -> None:
        self._doc_chunk_table_detail = DocChunkTableDetail()

    def table_idx(self, table_idx: int) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.table_idx = table_idx
        return self

    def text(self, text: str) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.text = text
        return self

    def cells(self, cells: List[DocChunkTableRow]) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.cells = cells
        return self

    def table_name(self, table_name: str) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.table_name = table_name
        return self

    def caption(self, caption: str) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.caption = caption
        return self

    def md_text(self, md_text: str) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.md_text = md_text
        return self

    def html_text(self, html_text: str) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.html_text = html_text
        return self

    def table_img(self, table_img: TableImg) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.table_img = table_img
        return self

    def sub_table_idx(self, sub_table_idx: int) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.sub_table_idx = sub_table_idx
        return self

    def table_range(self, table_range: str) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.table_range = table_range
        return self

    def header_ranges(self, header_ranges: List[str]) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.header_ranges = header_ranges
        return self

    def desc_ranges(self, desc_ranges: List[str]) -> "DocChunkTableDetailBuilder":
        self._doc_chunk_table_detail.desc_ranges = desc_ranges
        return self

    def build(self) -> "DocChunkTableDetail":
        return self._doc_chunk_table_detail
