44 lines
874 B
Python
44 lines
874 B
Python
from __future__ import annotations
|
|
|
|
from typing import Literal, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
SwitchType = Literal[
|
|
"cream",
|
|
"holypanda",
|
|
"alpaca",
|
|
"turquoise",
|
|
"inkblack",
|
|
"inkred",
|
|
"mxblack",
|
|
"mxbrown",
|
|
"mxblue",
|
|
"boxnavy",
|
|
"buckling",
|
|
"alpsblue",
|
|
"topre",
|
|
]
|
|
|
|
|
|
class Marker(BaseModel):
|
|
id: str
|
|
time: float = Field(ge=0)
|
|
key: str
|
|
code: Optional[str] = None
|
|
release_time: Optional[float] = Field(default=None, ge=0, alias="releaseTime")
|
|
|
|
model_config = {"populate_by_name": True}
|
|
|
|
|
|
class Project(BaseModel):
|
|
version: int = 2
|
|
switch: SwitchType = "mxbrown"
|
|
markers: list[Marker] = Field(default_factory=list)
|
|
|
|
|
|
class ExportRequest(BaseModel):
|
|
duration: float = Field(gt=0)
|
|
switch: SwitchType = "mxbrown"
|
|
markers: list[Marker] = Field(default_factory=list)
|