# This file was auto-generated by Fern from our API Definition.

import typing

import typing_extensions
from ..core.serialization import FieldMetadata
from ..types.rule_validation_result_rules_item_failure_reason import RuleValidationResultRulesItemFailureReason


class RuleValidationResultRulesItemParams(typing_extensions.TypedDict):
    name: str
    """
    The name of the validation rule.
    """

    valid: bool
    """
    Indicates whether this validation rule passed or not. This field will be `true` only if the formula evaluates to `true`. If the rule's formula is array valued, then this field will only be `true` if the formula evaluates to `true` for every item in the array.
    """

    valid_array: typing_extensions.NotRequired[
        typing_extensions.Annotated[typing.Sequence[bool], FieldMetadata(alias="validArray")]
    ]
    """
    Present if the validation rule's formula is array valued. This field contains the formula's evaluated result for every item in the array.
    """

    failure_reason: typing_extensions.NotRequired[
        typing_extensions.Annotated[RuleValidationResultRulesItemFailureReason, FieldMetadata(alias="failureReason")]
    ]
    """
    If the validation rule is not valid, then this describes why the rule failed.
    * `"RULE_FAILED"` - The formula evaluated to `false` or `null`
    * `"PARSE_ERROR"` - The formula could not be parsed
    * `"VALUE_ERROR"` - An error occurred while evaluating the formula
    """

    error: typing_extensions.NotRequired[str]
    """
    If the `failureReason` is `PARSE_ERROR` or `VALUE_ERROR`, then this field contains the error's details.
    """
