# 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 .table_meta import TableMeta
from .table_cell import TableCell


class Table(object):
    _types = {
        "meta": TableMeta,
        "title": str,
        "cells": List[TableCell],
    }

    def __init__(self, d=None):
        self.meta: Optional[TableMeta] = None
        self.title: Optional[str] = None
        self.cells: Optional[List[TableCell]] = None
        init(self, d, self._types)

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


class TableBuilder(object):
    def __init__(self) -> None:
        self._table = Table()

    def meta(self, meta: TableMeta) -> "TableBuilder":
        self._table.meta = meta
        return self

    def title(self, title: str) -> "TableBuilder":
        self._table.title = title
        return self

    def cells(self, cells: List[TableCell]) -> "TableBuilder":
        self._table.cells = cells
        return self

    def build(self) -> "Table":
        return self._table
