-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9453be3
commit c14a139
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from typing import ( | ||
List, | ||
Literal, | ||
Optional, | ||
Tuple, | ||
Union, | ||
) | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class BaseComment(BaseModel): | ||
id: int | ||
colour: Literal["none", "black", "blue" "turquoise", "green", "lime", "orange", "yellow", "red", "pink"] | ||
position: Tuple[float, float] | ||
size: Tuple[float, float] | ||
|
||
|
||
class TextCommentData(BaseModel): | ||
bold: Optional[bool] | ||
italic: Optional[bool] | ||
size: int | ||
text: str | ||
|
||
|
||
class TextComment(BaseComment): | ||
type: Literal["text"] | ||
data: TextCommentData | ||
|
||
|
||
class MarkdownCommentData(BaseModel): | ||
text: str | ||
|
||
|
||
class MarkdownComment(BaseComment): | ||
type: Literal["markdown"] | ||
data: MarkdownCommentData | ||
|
||
|
||
class FrameCommentData(BaseModel): | ||
title: str | ||
|
||
|
||
class FrameComment(BaseComment): | ||
type: Literal["frame"] | ||
data: FrameCommentData | ||
child_comments: Optional[List[int]] | ||
child_steps: Optional[List[int]] | ||
|
||
|
||
class FreehandCommentData(BaseModel): | ||
thickness: int | ||
line: List[Tuple[float, float]] | ||
|
||
|
||
class FreehandComment(BaseComment): | ||
type: Literal["freehand"] | ||
data: FreehandCommentData | ||
|
||
|
||
class WorkflowCommentModel(BaseModel): | ||
__root__: Union[TextComment, MarkdownComment, FrameComment, FreehandComment] |