import datetime
import enum
from typing import Any

import msgspec

from csirtmu.beta_temporal.constants import WorkflowReference
from csirtmu.beta_temporal.external_services.rt import structs


class TransactionStateEnum(enum.Enum):
    PENDING = "Pending"
    PROCESSING = "Processing"


class RedisStruct(msgspec.Struct):
    task_queue: str
    transaction: structs.TransactionStruct
    timestamp: datetime.datetime
    error: str
    workflows: list[tuple[WorkflowReference, dict[str, Any] | None]]
    state: TransactionStateEnum = TransactionStateEnum.PENDING
