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

from __future__ import annotations
from .flow import Flow
from .flowaction import FlowAction
from datetime import datetime
from gr4vy.types import BaseModel
from gr4vy.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import Any, Dict, Literal, Optional
from typing_extensions import Annotated, TypedDict


class TransactionActionTypedDict(TypedDict):
    id: FlowAction
    flow: Flow
    rule_id: str
    r"""The ID of the rule that triggered this action."""
    created_at: datetime
    r"""The date this action was created at."""
    outcome: Dict[str, Any]
    r"""The outcome of the action."""
    type: Literal["action"]
    r"""Always `action`."""


class TransactionAction(BaseModel):
    id: FlowAction

    flow: Flow

    rule_id: str
    r"""The ID of the rule that triggered this action."""

    created_at: datetime
    r"""The date this action was created at."""

    outcome: Dict[str, Any]
    r"""The outcome of the action."""

    TYPE: Annotated[
        Annotated[
            Optional[Literal["action"]], AfterValidator(validate_const("action"))
        ],
        pydantic.Field(alias="type"),
    ] = "action"
    r"""Always `action`."""
