# 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 .filter_condition import FilterCondition


class FilterExpression(object):
    _types = {
        "conditions": List[FilterCondition],
        "expression": str,
    }

    def __init__(self, d=None):
        self.conditions: Optional[List[FilterCondition]] = None
        self.expression: Optional[str] = None
        init(self, d, self._types)

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


class FilterExpressionBuilder(object):
    def __init__(self) -> None:
        self._filter_expression = FilterExpression()

    def conditions(self, conditions: List[FilterCondition]) -> "FilterExpressionBuilder":
        self._filter_expression.conditions = conditions
        return self

    def expression(self, expression: str) -> "FilterExpressionBuilder":
        self._filter_expression.expression = expression
        return self

    def build(self) -> "FilterExpression":
        return self._filter_expression
