# 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 .value import Value


class Expression(object):
    _types = {
        "field": str,
        "operator": str,
        "value": Value,
    }

    def __init__(self, d=None):
        self.field: Optional[str] = None
        self.operator: Optional[str] = None
        self.value: Optional[Value] = None
        init(self, d, self._types)

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


class ExpressionBuilder(object):
    def __init__(self) -> None:
        self._expression = Expression()

    def field(self, field: str) -> "ExpressionBuilder":
        self._expression.field = field
        return self

    def operator(self, operator: str) -> "ExpressionBuilder":
        self._expression.operator = operator
        return self

    def value(self, value: Value) -> "ExpressionBuilder":
        self._expression.value = value
        return self

    def build(self) -> "Expression":
        return self._expression
