use super::spec::SpecContentData;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FoundryResponse<T> {
pub data: T,
pub validation_status: ValidationStatus,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub next_steps: Vec<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub workflow_hints: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum ValidationStatus {
Complete,
Incomplete,
Error,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateProjectResponse {
pub project_name: String,
pub created_at: String,
pub project_path: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub files_created: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ListProjectsResponse {
pub projects: Vec<ProjectInfo>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectInfo {
pub name: String,
pub created_at: String,
pub spec_count: usize,
pub path: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ListSpecsResponse {
pub project_name: String,
pub specs: Vec<SpecInfo>,
pub total_count: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LoadProjectResponse {
pub project: ProjectContext,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectContext {
pub name: String,
pub vision: String,
pub tech_stack: String,
pub summary: String,
pub created_at: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub specs_available: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateSpecResponse {
pub project_name: String,
pub spec_name: String,
pub created_at: String,
pub spec_path: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub files_created: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LoadSpecResponse {
pub project_name: String,
pub project_summary: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub spec_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub spec_content: Option<SpecContent>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub available_specs: Vec<SpecInfo>,
#[serde(skip_serializing_if = "Option::is_none")]
pub match_info: Option<MatchInfo>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SpecInfo {
pub name: String,
pub feature_name: String,
pub created_at: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MatchInfo {
pub requested_spec: String,
pub matched_spec: String,
pub match_type: String, pub confidence: f32, }
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SpecContent {
pub content: SpecContentData,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AnalyzeProjectResponse {
pub project_name: String,
pub files_created: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetFoundryHelpResponse {
pub topic: String,
pub content: HelpContent,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HelpContent {
pub title: String,
pub description: String,
pub examples: Vec<String>,
pub workflow_guide: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValidateContentResponse {
pub content_type: String,
pub is_valid: bool,
pub validation_errors: Vec<String>,
pub suggestions: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UpdateSpecResponse {
pub project_name: String,
pub spec_name: String,
pub files_updated: Vec<FileUpdateResult>,
pub total_files_updated: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FileUpdateResult {
pub file_type: String,
pub operation_performed: String,
pub file_path: String,
pub content_length: usize,
pub success: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub lines_modified: Option<usize>,
#[serde(skip_serializing_if = "Option::is_none")]
pub patch_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub match_confidence: Option<f32>,
}
#[derive(Serialize, Debug, Clone)]
pub struct EditCommandsResponsePayload {
pub applied_count: usize,
pub skipped_idempotent_count: usize,
pub file_updates: Vec<crate::types::edit_commands::FileUpdateSummary>,
#[serde(skip_serializing_if = "Option::is_none")]
pub errors: Option<Vec<crate::types::edit_commands::EditCommandError>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub preview_diff: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DeleteSpecResponse {
pub project_name: String,
pub spec_name: String,
pub spec_path: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub files_deleted: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct InstallResponse {
pub target: String,
pub binary_path: String,
pub config_path: String,
pub installation_status: InstallationStatus,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub actions_taken: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UninstallResponse {
pub target: String,
pub config_path: String,
pub uninstallation_status: InstallationStatus,
pub actions_taken: Vec<String>,
pub files_removed: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StatusResponse {
pub binary_path: String,
pub binary_found: bool,
pub environments: Vec<EnvironmentStatus>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum InstallationStatus {
Success,
Partial,
Failed,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EnvironmentStatus {
pub name: String,
pub installed: bool,
pub config_path: String,
pub config_exists: bool,
pub binary_path: String,
pub binary_accessible: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub config_content: Option<String>,
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub issues: Vec<String>,
}