# 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 import I18n


class CollectionItem(object):
    _types = {
        "template_id": str,
        "template_version_id": str,
        "item_id": str,
        "item_name": I18n,
        "field_type": int,
        "decimal_places": int,
        "calc_method": int,
        "preset": bool,
        "is_required": bool,
    }

    def __init__(self, d=None):
        self.template_id: Optional[str] = None
        self.template_version_id: Optional[str] = None
        self.item_id: Optional[str] = None
        self.item_name: Optional[I18n] = None
        self.field_type: Optional[int] = None
        self.decimal_places: Optional[int] = None
        self.calc_method: Optional[int] = None
        self.preset: Optional[bool] = None
        self.is_required: Optional[bool] = None
        init(self, d, self._types)

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


class CollectionItemBuilder(object):
    def __init__(self) -> None:
        self._collection_item = CollectionItem()

    def template_id(self, template_id: str) -> "CollectionItemBuilder":
        self._collection_item.template_id = template_id
        return self

    def template_version_id(self, template_version_id: str) -> "CollectionItemBuilder":
        self._collection_item.template_version_id = template_version_id
        return self

    def item_id(self, item_id: str) -> "CollectionItemBuilder":
        self._collection_item.item_id = item_id
        return self

    def item_name(self, item_name: I18n) -> "CollectionItemBuilder":
        self._collection_item.item_name = item_name
        return self

    def field_type(self, field_type: int) -> "CollectionItemBuilder":
        self._collection_item.field_type = field_type
        return self

    def decimal_places(self, decimal_places: int) -> "CollectionItemBuilder":
        self._collection_item.decimal_places = decimal_places
        return self

    def calc_method(self, calc_method: int) -> "CollectionItemBuilder":
        self._collection_item.calc_method = calc_method
        return self

    def preset(self, preset: bool) -> "CollectionItemBuilder":
        self._collection_item.preset = preset
        return self

    def is_required(self, is_required: bool) -> "CollectionItemBuilder":
        self._collection_item.is_required = is_required
        return self

    def build(self) -> "CollectionItem":
        return self._collection_item
