"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from paygentic_sdk.types import BaseModel, UnrecognizedStr
import pydantic
from typing import Literal, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict


Operator = Union[
    Literal[
        "equals",
        "contains",
        "between",
        "greaterThan",
        "lessThan",
        "domain",
    ],
    UnrecognizedStr,
]
r"""The comparison operator to use"""


RuleConditionType = Union[
    Literal[
        "date",
        "customerName",
        "customerEmail",
        "amount",
    ],
    UnrecognizedStr,
]
r"""The type of field to evaluate"""


FromTypedDict = TypeAliasType("FromTypedDict", Union[str, float])


From = TypeAliasType("From", Union[str, float])


ToTypedDict = TypeAliasType("ToTypedDict", Union[str, float])


To = TypeAliasType("To", Union[str, float])


class ValueTypedDict(TypedDict):
    from_: FromTypedDict
    to: ToTypedDict


class Value(BaseModel):
    from_: Annotated[From, pydantic.Field(alias="from")]

    to: To


ValueUnionTypedDict = TypeAliasType(
    "ValueUnionTypedDict", Union[ValueTypedDict, str, float]
)
r"""The value to compare against"""


ValueUnion = TypeAliasType("ValueUnion", Union[Value, str, float])
r"""The value to compare against"""


class RuleConditionTypedDict(TypedDict):
    r"""A single condition that must be met for a rule to trigger auto-acceptance. Multiple conditions in a rule use AND logic."""

    operator: Operator
    r"""The comparison operator to use"""
    type: RuleConditionType
    r"""The type of field to evaluate"""
    value: ValueUnionTypedDict
    r"""The value to compare against"""


class RuleCondition(BaseModel):
    r"""A single condition that must be met for a rule to trigger auto-acceptance. Multiple conditions in a rule use AND logic."""

    operator: Operator
    r"""The comparison operator to use"""

    type: RuleConditionType
    r"""The type of field to evaluate"""

    value: ValueUnion
    r"""The value to compare against"""


try:
    Value.model_rebuild()
except NameError:
    pass
