# 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_setting import FieldSetting


class Field(object):
    _types = {
        "api_name": str,
        "label": Dict[str, str],
        "ai_description": str,
        "access_items": List[str],
        "type_name": str,
        "field_setting": FieldSetting,
    }

    def __init__(self, d=None):
        self.api_name: Optional[str] = None
        self.label: Optional[Dict[str, str]] = None
        self.ai_description: Optional[str] = None
        self.access_items: Optional[List[str]] = None
        self.type_name: Optional[str] = None
        self.field_setting: Optional[FieldSetting] = None
        init(self, d, self._types)

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


class FieldBuilder(object):
    def __init__(self) -> None:
        self._field = Field()

    def api_name(self, api_name: str) -> "FieldBuilder":
        self._field.api_name = api_name
        return self

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

    def ai_description(self, ai_description: str) -> "FieldBuilder":
        self._field.ai_description = ai_description
        return self

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

    def type_name(self, type_name: str) -> "FieldBuilder":
        self._field.type_name = type_name
        return self

    def field_setting(self, field_setting: FieldSetting) -> "FieldBuilder":
        self._field.field_setting = field_setting
        return self

    def build(self) -> "Field":
        return self._field
