# 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 .rec_rule_condition import RecRuleCondition


class RecRule(object):
    _types = {
        "conditions": List[RecRuleCondition],
        "conjunction": str,
        "perm": int,
        "other_perm": int,
    }

    def __init__(self, d=None):
        self.conditions: Optional[List[RecRuleCondition]] = None
        self.conjunction: Optional[str] = None
        self.perm: Optional[int] = None
        self.other_perm: Optional[int] = None
        init(self, d, self._types)

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


class RecRuleBuilder(object):
    def __init__(self) -> None:
        self._rec_rule = RecRule()

    def conditions(self, conditions: List[RecRuleCondition]) -> "RecRuleBuilder":
        self._rec_rule.conditions = conditions
        return self

    def conjunction(self, conjunction: str) -> "RecRuleBuilder":
        self._rec_rule.conjunction = conjunction
        return self

    def perm(self, perm: int) -> "RecRuleBuilder":
        self._rec_rule.perm = perm
        return self

    def other_perm(self, other_perm: int) -> "RecRuleBuilder":
        self._rec_rule.other_perm = other_perm
        return self

    def build(self) -> "RecRule":
        return self._rec_rule
