# 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 .i18n_content import I18nContent
from .i18n_content import I18nContent


class DatasourceField(object):
    _types = {
        "code": str,
        "i18n_names": List[I18nContent],
        "field_type": int,
        "active_status": int,
        "i18n_description": List[I18nContent],
        "decimal_places": int,
    }

    def __init__(self, d=None):
        self.code: Optional[str] = None
        self.i18n_names: Optional[List[I18nContent]] = None
        self.field_type: Optional[int] = None
        self.active_status: Optional[int] = None
        self.i18n_description: Optional[List[I18nContent]] = None
        self.decimal_places: Optional[int] = None
        init(self, d, self._types)

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


class DatasourceFieldBuilder(object):
    def __init__(self) -> None:
        self._datasource_field = DatasourceField()

    def code(self, code: str) -> "DatasourceFieldBuilder":
        self._datasource_field.code = code
        return self

    def i18n_names(self, i18n_names: List[I18nContent]) -> "DatasourceFieldBuilder":
        self._datasource_field.i18n_names = i18n_names
        return self

    def field_type(self, field_type: int) -> "DatasourceFieldBuilder":
        self._datasource_field.field_type = field_type
        return self

    def active_status(self, active_status: int) -> "DatasourceFieldBuilder":
        self._datasource_field.active_status = active_status
        return self

    def i18n_description(self, i18n_description: List[I18nContent]) -> "DatasourceFieldBuilder":
        self._datasource_field.i18n_description = i18n_description
        return self

    def decimal_places(self, decimal_places: int) -> "DatasourceFieldBuilder":
        self._datasource_field.decimal_places = decimal_places
        return self

    def build(self) -> "DatasourceField":
        return self._datasource_field
