|
1 | | -from typing import Literal |
| 1 | +from typing import Literal, Optional |
2 | 2 |
|
3 | 3 | from pydantic import BaseModel, Field |
4 | 4 |
|
5 | 5 | from .base import ActionNames, BaseAction |
6 | 6 |
|
7 | 7 |
|
8 | | -class TaskParameter(BaseModel): |
9 | | - task_id: str = Field(..., description="Identifier for the task this parameter belongs to") |
10 | | - name: str = Field(..., description="Name of the parameter") |
11 | | - value: str = Field(..., description="Value of the parameter") |
| 8 | +class Subject(BaseModel): |
| 9 | + subject_id: str = Field(..., description="ID of the subject, eg. a role name or personalnummer") |
| 10 | + subject_type: Literal["Person", "PCS Role", "Common Role"] = Field( |
| 11 | + ..., description="Type of the subject: Person, PCS Role or Common Role" |
| 12 | + ) |
| 13 | + |
| 14 | + |
| 15 | +class TaskConfiguration(BaseModel): |
| 16 | + task_id: str = Field(..., description="Identifier for the task") |
| 17 | + responsible: Optional[Subject] = Field(default=None, description="Responsible subject for the task") |
| 18 | + recipients: list[Subject] = Field( |
| 19 | + default_factory=list, |
| 20 | + description="List of recipients for the task (only used by information tasks)", |
| 21 | + ) |
12 | 22 |
|
13 | 23 |
|
14 | 24 | class StartWorkflowAction(BaseAction): |
15 | 25 | name: Literal[ActionNames.START_WORKFLOW] = ActionNames.START_WORKFLOW |
16 | 26 | template_id: str = Field(..., description="ID of the workflow template to start") |
17 | 27 | cdb_project_id: str | None = Field( |
18 | | - default=None, description="ID of the project in which the workflow should be started" |
| 28 | + default=None, |
| 29 | + description="ID of the project in which the workflow should be started", |
19 | 30 | ) |
20 | 31 | title: str = Field(..., description="Title of the workflow") |
21 | 32 | attachment_ids: list[str] = Field( |
22 | | - default_factory=list, description="List of cdb_object_ids to attach to the workflow" |
| 33 | + default_factory=list, |
| 34 | + description="List of cdb_object_ids to attach to the workflow", |
23 | 35 | ) |
24 | 36 | global_briefcase_object_ids: list[str] = Field( |
25 | | - default_factory=list, description="List of cdb_object_ids to attach to the global briefcase" |
| 37 | + default_factory=list, |
| 38 | + description="List of cdb_object_ids to attach to the global briefcase", |
| 39 | + ) |
| 40 | + task_configurations: list[TaskConfiguration] = Field( |
| 41 | + default_factory=list, description="List of task configurations" |
26 | 42 | ) |
27 | | - task_parameters: list[TaskParameter] = Field(default_factory=list, description="List of task parameters") |
|
0 commit comments