package projectinstance import ( "time" "chat-agent-system/internal/workflowdef" ) const ( LifecyclePlanning = "planning" LifecycleActive = "active" InstancePlanning = "planning" InstanceActive = "active" DutyAuthor = "author" DutyReviewer = "reviewer" DutyApprover = "approver" ) // DocDuty 文档三权职责指派。 type DocDuty struct { AuthorUserID int64 `json:"author_user_id,omitempty"` ReviewerUserID int64 `json:"reviewer_user_id,omitempty"` ApproverUserID int64 `json:"approver_user_id,omitempty"` } // DocTaskPlan 文档任务裁剪与职责。 type DocTaskPlan struct { TaskKey string `json:"task_key"` Enabled bool `json:"enabled"` Duties DocDuty `json:"duties"` } // StagePlan 阶段裁剪与文档任务。 type StagePlan struct { StageKey string `json:"stage_key"` Enabled bool `json:"enabled"` DocTasks []DocTaskPlan `json:"doc_tasks"` } // WorkflowPlan 项目工作流规划快照。 type WorkflowPlan struct { WorkflowDefinitionKey string `json:"workflow_definition_key"` WorkflowVersion int `json:"workflow_version"` WorkflowVersionID int64 `json:"workflow_version_id,omitempty"` Stages []StagePlan `json:"stages"` } // WorkflowInstance 项目工作流实例。 type WorkflowInstance struct { ID int64 `json:"id"` ProjectID int64 `json:"project_id"` WorkflowVersionID int64 `json:"workflow_version_id"` InstanceNo int `json:"instance_no"` Status string `json:"status"` ConfigRevision int `json:"config_revision"` PlanHash string `json:"plan_hash"` ConfigSnapshot WorkflowPlan `json:"config_snapshot"` ActivatedBy *int64 `json:"activated_by,omitempty"` ActivatedAt *time.Time `json:"activated_at,omitempty"` CreatedBy *int64 `json:"created_by,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // ProjectSettings 项目设置聚合视图。 type ProjectSettings struct { ProjectID int64 `json:"project_id"` LifecycleStatus string `json:"lifecycle_status"` ActiveWorkflowKey string `json:"active_workflow_key"` WorkflowSelectionVersion int `json:"workflow_selection_version"` WorkflowPlanRevision int `json:"workflow_plan_revision"` Plan *WorkflowPlan `json:"plan,omitempty"` PlanningInstance *WorkflowInstance `json:"planning_instance,omitempty"` LiveInstance *WorkflowInstance `json:"live_instance,omitempty"` CanEditPlan bool `json:"can_edit_plan"` CanActivate bool `json:"can_activate"` PublishedWorkflows []PublishedOption `json:"published_workflows,omitempty"` } // PublishedOption 可选已发布工作流。 type PublishedOption struct { DefinitionKey string `json:"definition_key"` DefinitionName string `json:"definition_name"` LatestVersion int `json:"latest_version"` WorkflowVersion int64 `json:"workflow_version_id"` ProductDomain string `json:"product_domain,omitempty"` } // SavePlanInput 保存工作流规划。 type SavePlanInput struct { Plan WorkflowPlan `json:"plan"` ExpectedPlanRevision int `json:"expected_plan_revision"` ExpectedSelectionVersion int `json:"expected_selection_version"` } // ActivationPreview 激活预览与确认令牌。 type ActivationPreview struct { ConfirmationToken string `json:"confirmation_token"` PlanHash string `json:"plan_hash"` ExpectedProjectVersion int `json:"expected_project_version"` ExpectedPlanRevision int `json:"expected_plan_revision"` Summary PreviewSummary `json:"summary"` Validation workflowdef.ValidationResult `json:"validation"` ExpiresAt time.Time `json:"expires_at"` } // PreviewSummary 激活影响摘要。 type PreviewSummary struct { WorkflowName string `json:"workflow_name"` WorkflowVersion int `json:"workflow_version"` EnabledStages int `json:"enabled_stages"` EnabledDocTasks int `json:"enabled_doc_tasks"` AssignedDuties int `json:"assigned_duties"` FirstStageKey string `json:"first_stage_key,omitempty"` FirstStageName string `json:"first_stage_name,omitempty"` } // ActivateInput 二次确认激活。 type ActivateInput struct { ConfirmationToken string `json:"confirmation_token"` ExpectedProjectVersion int `json:"expected_project_version"` ExpectedPlanRevision int `json:"expected_plan_revision"` } // ActivateResult 激活结果。 type ActivateResult struct { ProjectID int64 `json:"project_id"` LifecycleStatus string `json:"lifecycle_status"` ActiveWorkflowKey string `json:"active_workflow_key"` Instance WorkflowInstance `json:"instance"` }