38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
# 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 import Condition
|
|
|
|
|
|
class Criterion(object):
|
|
_types = {
|
|
"conditions": List[Condition],
|
|
"logic_expression": str,
|
|
}
|
|
|
|
def __init__(self, d=None):
|
|
self.conditions: Optional[List[Condition]] = None
|
|
self.logic_expression: Optional[str] = None
|
|
init(self, d, self._types)
|
|
|
|
@staticmethod
|
|
def builder() -> "CriterionBuilder":
|
|
return CriterionBuilder()
|
|
|
|
|
|
class CriterionBuilder(object):
|
|
def __init__(self) -> None:
|
|
self._criterion = Criterion()
|
|
|
|
def conditions(self, conditions: List[Condition]) -> "CriterionBuilder":
|
|
self._criterion.conditions = conditions
|
|
return self
|
|
|
|
def logic_expression(self, logic_expression: str) -> "CriterionBuilder":
|
|
self._criterion.logic_expression = logic_expression
|
|
return self
|
|
|
|
def build(self) -> "Criterion":
|
|
return self._criterion
|