# 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 .formula_param import FormulaParam


class Formula(object):
    _types = {
        "expr": str,
        "formula_params": List[FormulaParam],
    }

    def __init__(self, d=None):
        self.expr: Optional[str] = None
        self.formula_params: Optional[List[FormulaParam]] = None
        init(self, d, self._types)

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


class FormulaBuilder(object):
    def __init__(self) -> None:
        self._formula = Formula()

    def expr(self, expr: str) -> "FormulaBuilder":
        self._formula.expr = expr
        return self

    def formula_params(self, formula_params: List[FormulaParam]) -> "FormulaBuilder":
        self._formula.formula_params = formula_params
        return self

    def build(self) -> "Formula":
        return self._formula
