106 lines
2.9 KiB
Python
106 lines
2.9 KiB
Python
"""PMFlow Project Launch API schemas."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Literal, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class PMFlowLaunchAttachment(BaseModel):
|
|
type: str = "text"
|
|
name: Optional[str] = None
|
|
summary: Optional[str] = None
|
|
payload: Optional[dict[str, Any]] = None
|
|
|
|
|
|
class PMFlowLaunchDraftRequest(BaseModel):
|
|
input: str = Field(min_length=1, max_length=4000)
|
|
input_type: Literal["text", "file", "screenshot", "template"] = "text"
|
|
attachments: list[PMFlowLaunchAttachment] = Field(default_factory=list)
|
|
source: str = "web"
|
|
|
|
|
|
class PMFlowLaunchRequirement(BaseModel):
|
|
title: str
|
|
summary: str = ""
|
|
acceptance_criteria: list[str] = Field(default_factory=list)
|
|
|
|
|
|
class PMFlowLaunchRisk(BaseModel):
|
|
title: str
|
|
summary: str = ""
|
|
level: Literal["low", "medium", "high"] = "medium"
|
|
mitigation: str = ""
|
|
|
|
|
|
class PMFlowLaunchDecision(BaseModel):
|
|
title: str
|
|
reason: str = ""
|
|
owner: str = ""
|
|
|
|
|
|
class PMFlowLaunchTask(BaseModel):
|
|
title: str
|
|
summary: str = ""
|
|
group: Literal["product", "engineering", "qa"] = "product"
|
|
priority: Literal["low", "medium", "high", "urgent"] = "medium"
|
|
acceptance_criteria: list[str] = Field(default_factory=list)
|
|
requirement_index: Optional[int] = None
|
|
|
|
|
|
class PMFlowLaunchEvidence(BaseModel):
|
|
source: str = "user_input"
|
|
excerpt: str
|
|
|
|
|
|
class PMFlowLaunchDraftPayload(BaseModel):
|
|
title: str
|
|
one_liner: str
|
|
target_user: str
|
|
problem: str
|
|
solution: str
|
|
requirements: list[PMFlowLaunchRequirement] = Field(default_factory=list)
|
|
risks: list[PMFlowLaunchRisk] = Field(default_factory=list)
|
|
decisions: list[PMFlowLaunchDecision] = Field(default_factory=list)
|
|
tasks: list[PMFlowLaunchTask] = Field(default_factory=list)
|
|
evidence: list[PMFlowLaunchEvidence] = Field(default_factory=list)
|
|
confidence: float = 0.0
|
|
warnings: list[str] = Field(default_factory=list)
|
|
|
|
|
|
class PMFlowLaunchDraftResponse(PMFlowLaunchDraftPayload):
|
|
draft_id: str
|
|
status: str = "draft"
|
|
expires_at: str
|
|
|
|
|
|
class PMFlowLaunchConfirmRequest(BaseModel):
|
|
edited_draft: dict[str, Any] = Field(default_factory=dict)
|
|
confirm: bool = True
|
|
|
|
|
|
class PMFlowLaunchConfirmResponse(BaseModel):
|
|
project_id: int
|
|
redirect_url: str
|
|
created_truth_node_ids: list[int] = Field(default_factory=list)
|
|
created_task_ids: list[int] = Field(default_factory=list)
|
|
thread_id: Optional[int] = None
|
|
thread_message_id: Optional[int] = None
|
|
warnings: list[str] = Field(default_factory=list)
|
|
|
|
|
|
__all__ = [
|
|
"PMFlowLaunchAttachment",
|
|
"PMFlowLaunchConfirmRequest",
|
|
"PMFlowLaunchConfirmResponse",
|
|
"PMFlowLaunchDecision",
|
|
"PMFlowLaunchDraftPayload",
|
|
"PMFlowLaunchDraftRequest",
|
|
"PMFlowLaunchDraftResponse",
|
|
"PMFlowLaunchEvidence",
|
|
"PMFlowLaunchRequirement",
|
|
"PMFlowLaunchRisk",
|
|
"PMFlowLaunchTask",
|
|
]
|