"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
Copyright 2022 Lekko Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import google.protobuf.struct_pb2
import sys
import typing

if sys.version_info >= (3, 10):
    import typing as typing_extensions
else:
    import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

class _ComparisonOperator:
    ValueType = typing.NewType("ValueType", builtins.int)
    V: typing_extensions.TypeAlias = ValueType

class _ComparisonOperatorEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_ComparisonOperator.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    COMPARISON_OPERATOR_UNSPECIFIED: _ComparisonOperator.ValueType  # 0
    COMPARISON_OPERATOR_EQUALS: _ComparisonOperator.ValueType  # 1
    """== only applies to number, string and bool values."""
    COMPARISON_OPERATOR_LESS_THAN: _ComparisonOperator.ValueType  # 2
    """> < >= <= only applies to number values."""
    COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS: _ComparisonOperator.ValueType  # 3
    COMPARISON_OPERATOR_GREATER_THAN: _ComparisonOperator.ValueType  # 4
    COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS: _ComparisonOperator.ValueType  # 5
    COMPARISON_OPERATOR_CONTAINED_WITHIN: _ComparisonOperator.ValueType  # 6
    """Contained within only applies to list values. Elements
    of the list must be primitive (i.e. number, string or bool)
    """
    COMPARISON_OPERATOR_STARTS_WITH: _ComparisonOperator.ValueType  # 7
    """Starts with and ends with only apply to string values."""
    COMPARISON_OPERATOR_ENDS_WITH: _ComparisonOperator.ValueType  # 8
    COMPARISON_OPERATOR_CONTAINS: _ComparisonOperator.ValueType  # 9
    """Contains only applies to string values, and for now is strict equality.
    If we support things like regex or case insensitive matches, they will
    be separate operators.
    """
    COMPARISON_OPERATOR_PRESENT: _ComparisonOperator.ValueType  # 10
    """Present is the only operator that doesn't require a comparison value."""

class ComparisonOperator(_ComparisonOperator, metaclass=_ComparisonOperatorEnumTypeWrapper): ...

COMPARISON_OPERATOR_UNSPECIFIED: ComparisonOperator.ValueType  # 0
COMPARISON_OPERATOR_EQUALS: ComparisonOperator.ValueType  # 1
"""== only applies to number, string and bool values."""
COMPARISON_OPERATOR_LESS_THAN: ComparisonOperator.ValueType  # 2
"""> < >= <= only applies to number values."""
COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS: ComparisonOperator.ValueType  # 3
COMPARISON_OPERATOR_GREATER_THAN: ComparisonOperator.ValueType  # 4
COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS: ComparisonOperator.ValueType  # 5
COMPARISON_OPERATOR_CONTAINED_WITHIN: ComparisonOperator.ValueType  # 6
"""Contained within only applies to list values. Elements
of the list must be primitive (i.e. number, string or bool)
"""
COMPARISON_OPERATOR_STARTS_WITH: ComparisonOperator.ValueType  # 7
"""Starts with and ends with only apply to string values."""
COMPARISON_OPERATOR_ENDS_WITH: ComparisonOperator.ValueType  # 8
COMPARISON_OPERATOR_CONTAINS: ComparisonOperator.ValueType  # 9
"""Contains only applies to string values, and for now is strict equality.
If we support things like regex or case insensitive matches, they will
be separate operators.
"""
COMPARISON_OPERATOR_PRESENT: ComparisonOperator.ValueType  # 10
"""Present is the only operator that doesn't require a comparison value."""
global___ComparisonOperator = ComparisonOperator

class _LogicalOperator:
    ValueType = typing.NewType("ValueType", builtins.int)
    V: typing_extensions.TypeAlias = ValueType

class _LogicalOperatorEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_LogicalOperator.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    LOGICAL_OPERATOR_UNSPECIFIED: _LogicalOperator.ValueType  # 0
    LOGICAL_OPERATOR_AND: _LogicalOperator.ValueType  # 1
    LOGICAL_OPERATOR_OR: _LogicalOperator.ValueType  # 2

class LogicalOperator(_LogicalOperator, metaclass=_LogicalOperatorEnumTypeWrapper): ...

LOGICAL_OPERATOR_UNSPECIFIED: LogicalOperator.ValueType  # 0
LOGICAL_OPERATOR_AND: LogicalOperator.ValueType  # 1
LOGICAL_OPERATOR_OR: LogicalOperator.ValueType  # 2
global___LogicalOperator = LogicalOperator

@typing_extensions.final
class Rule(google.protobuf.message.Message):
    """A Rule is a top level object that recursively defines an AST represented
    by ruleslang. A rule is always one of 4 things:
    1. Atom -> This is a leaf node in the tree that returns true or false
    2. Not -> This negates the result of the underlying Rule.
    3. LogicalExpression -> This rule links two rules through an "and" or an "or".
    4. BoolConst -> true or false. This will be used for higher level short-circuits.
    Parenthases and other logical constructs can all be represented by the correct
    construction of this rule tree.

    !(A && B && C) || D can be represented by LogExp ( Not ( LogExp ( LogExp ( Atom(A) && Atom(B) ) && Atom (C))) || Atom(D))
    """

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    ATOM_FIELD_NUMBER: builtins.int
    NOT_FIELD_NUMBER: builtins.int
    LOGICAL_EXPRESSION_FIELD_NUMBER: builtins.int
    BOOL_CONST_FIELD_NUMBER: builtins.int
    @property
    def atom(self) -> global___Atom: ...
    @property
    def logical_expression(self) -> global___LogicalExpression: ...
    bool_const: builtins.bool
    def __init__(
        self,
        *,
        atom: global___Atom | None = ...,
        logical_expression: global___LogicalExpression | None = ...,
        bool_const: builtins.bool = ...,
    ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["atom", b"atom", "bool_const", b"bool_const", "logical_expression", b"logical_expression", "not", b"not", "rule", b"rule"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["atom", b"atom", "bool_const", b"bool_const", "logical_expression", b"logical_expression", "not", b"not", "rule", b"rule"]) -> None: ...
    def WhichOneof(self, oneof_group: typing_extensions.Literal["rule", b"rule"]) -> typing_extensions.Literal["atom", "not", "logical_expression", "bool_const"] | None: ...

global___Rule = Rule

@typing_extensions.final
class LogicalExpression(google.protobuf.message.Message):
    """LogicalExpression operator applies a logical operator like "and" or "or" to two rules.
    They are evaluated in the order expressed by the field numbers and field names, with "first_rule" first.
    """

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    FIRST_RULE_FIELD_NUMBER: builtins.int
    SECOND_RULE_FIELD_NUMBER: builtins.int
    LOGICAL_OPERATOR_FIELD_NUMBER: builtins.int
    @property
    def first_rule(self) -> global___Rule: ...
    @property
    def second_rule(self) -> global___Rule: ...
    logical_operator: global___LogicalOperator.ValueType
    def __init__(
        self,
        *,
        first_rule: global___Rule | None = ...,
        second_rule: global___Rule | None = ...,
        logical_operator: global___LogicalOperator.ValueType = ...,
    ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["first_rule", b"first_rule", "second_rule", b"second_rule"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["first_rule", b"first_rule", "logical_operator", b"logical_operator", "second_rule", b"second_rule"]) -> None: ...

global___LogicalExpression = LogicalExpression

@typing_extensions.final
class Atom(google.protobuf.message.Message):
    """An atom is a fragment of ruleslang that can result in a true or false.
    An atom always has a comparison operator and a context key, and can optionally
    have a comparison value.
    """

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    CONTEXT_KEY_FIELD_NUMBER: builtins.int
    COMPARISON_VALUE_FIELD_NUMBER: builtins.int
    COMPARISON_OPERATOR_FIELD_NUMBER: builtins.int
    context_key: builtins.str
    @property
    def comparison_value(self) -> google.protobuf.struct_pb2.Value:
        """For the "PRESENT" operator, the comparison value should be null."""
    comparison_operator: global___ComparisonOperator.ValueType
    """For operators, context is on the left, comparison value on the right."""
    def __init__(
        self,
        *,
        context_key: builtins.str = ...,
        comparison_value: google.protobuf.struct_pb2.Value | None = ...,
        comparison_operator: global___ComparisonOperator.ValueType = ...,
    ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["comparison_value", b"comparison_value"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["comparison_operator", b"comparison_operator", "comparison_value", b"comparison_value", "context_key", b"context_key"]) -> None: ...

global___Atom = Atom
