33 lines
769 B
Python
33 lines
769 B
Python
from .base import BaseConfig, BaseMongoModel
|
|
|
|
from datetime import datetime
|
|
from pydantic import BaseModel, Field
|
|
from typing import Literal, Union, Annotated, Optional, List
|
|
|
|
|
|
class WaitAction(BaseModel):
|
|
action_type: Literal["wait"]
|
|
wait_for: int
|
|
|
|
class Config(BaseConfig):
|
|
pass
|
|
|
|
|
|
class TextCommentAction(BaseModel):
|
|
action_type: Literal["text_comment"]
|
|
text: str
|
|
|
|
class Config(BaseConfig):
|
|
pass
|
|
|
|
|
|
Action = Annotated[
|
|
Union[WaitAction, TextCommentAction], Field(description="action_type")
|
|
]
|
|
|
|
|
|
class Chain(BaseMongoModel):
|
|
name: Annotated[Optional[str], Field(default=None)]
|
|
actions: Annotated[Optional[List[Action]], Field(default=[])]
|
|
last_modified: Annotated[datetime, Field(default_factory=datetime.utcnow)]
|