# 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 .field import Field


class Table(object):
    _types = {
        "table_type": str,
        "api_name": str,
        "label": Dict[str, str],
        "access_items": List[str],
        "ai_description": str,
        "fields": List[Field],
    }

    def __init__(self, d=None):
        self.table_type: Optional[str] = None
        self.api_name: Optional[str] = None
        self.label: Optional[Dict[str, str]] = None
        self.access_items: Optional[List[str]] = None
        self.ai_description: Optional[str] = None
        self.fields: Optional[List[Field]] = None
        init(self, d, self._types)

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


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

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

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

    def label(self, label: Dict[str, str]) -> "TableBuilder":
        self._table.label = label
        return self

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

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

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

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