# 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 .condition_value import ConditionValue
from .condition_value import ConditionValue


class Condition(object):
    _types = {
        "index": str,
        "left": ConditionValue,
        "right": ConditionValue,
        "operator": str,
    }

    def __init__(self, d=None):
        self.index: Optional[str] = None
        self.left: Optional[ConditionValue] = None
        self.right: Optional[ConditionValue] = None
        self.operator: Optional[str] = None
        init(self, d, self._types)

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


class ConditionBuilder(object):
    def __init__(self) -> None:
        self._condition = Condition()

    def index(self, index: str) -> "ConditionBuilder":
        self._condition.index = index
        return self

    def left(self, left: ConditionValue) -> "ConditionBuilder":
        self._condition.left = left
        return self

    def right(self, right: ConditionValue) -> "ConditionBuilder":
        self._condition.right = right
        return self

    def operator(self, operator: str) -> "ConditionBuilder":
        self._condition.operator = operator
        return self

    def build(self) -> "Condition":
        return self._condition
