use serde::{Deserialize, Serialize};
use crate::{
api::{ApiMetadata, CodeRepositoryFreshnessDiagnostics, CodeRepositoryScopeMetadata},
domain::{
BusinessDomain, BusinessKnowledgeQueryRequest, BusinessKnowledgeResolution,
BusinessKnowledgeStatus, BusinessTerm, CodeFeatureFlagGraph, CodeFeatureFlagRequest,
CodeImpactPathGroups, CodeImpactRequest, CodeIndexCheckpoint, CodeIndexSummary,
CodeIndexTaskRecord, CodeRepositoryRegistration, CodeRepositoryRemovalSummary,
CodeRepositoryReport, CodeRepositoryScopePreview, CodeRepositoryStatus, CodeRetrievalHit,
CodeRetrievalRequest, CodeScopeRetentionSummary, FrameworkGraph, FrameworkGraphRequest,
RepositoryGraphEdge, RepositoryGraphNeighborhoodRequest, RepositoryGraphNode,
SoftwareBuildTarget, SoftwareComponent, SoftwareDependencyUsage, SoftwareDesignElement,
SoftwareFile, SoftwareGlobalRequest, SoftwareGlobalStatus, SoftwareIacResource,
SoftwareRelationship, SoftwareSdkUsage, SoftwareTopic,
},
};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryRegisterRequest {
pub root_path: String,
#[serde(default)]
pub alias: String,
#[serde(default)]
pub path_filters: Vec<String>,
#[serde(default)]
pub language_filters: Vec<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryUpdateRequest {
#[serde(default)]
pub repository: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub base_ref: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub head_ref: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryRegisterResponse {
pub metadata: ApiMetadata,
pub registration: CodeRepositoryRegistration,
pub status: CodeRepositoryStatus,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryListResponse {
pub metadata: ApiMetadata,
pub repositories: Vec<CodeRepositoryStatus>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryRemoveResponse {
pub metadata: ApiMetadata,
pub removed_status: CodeRepositoryStatus,
pub summary: CodeRepositoryRemovalSummary,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryIndexResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
pub summary: CodeIndexSummary,
pub status: CodeRepositoryStatus,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryIndexStartResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
#[serde(skip_serializing_if = "Option::is_none")]
pub summary: Option<CodeIndexSummary>,
pub status: CodeRepositoryStatus,
#[serde(skip_serializing_if = "Option::is_none")]
pub task: Option<CodeIndexTaskRecord>,
#[serde(skip_serializing_if = "Option::is_none")]
pub checkpoint: Option<CodeIndexCheckpoint>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryIndexResetResponse {
pub metadata: ApiMetadata,
pub status: CodeRepositoryStatus,
pub reset_task_count: usize,
pub reset_tasks: Vec<CodeIndexTaskRecord>,
#[serde(skip_serializing_if = "Option::is_none")]
pub active_task: Option<CodeIndexTaskRecord>,
#[serde(skip_serializing_if = "Option::is_none")]
pub checkpoint: Option<CodeIndexCheckpoint>,
pub retention: CodeScopeRetentionSummary,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryScopePreviewResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
pub preview: CodeRepositoryScopePreview,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CodeRepositoryQueryResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
#[serde(default = "CodeRepositoryFreshnessDiagnostics::legacy_unknown")]
pub freshness: CodeRepositoryFreshnessDiagnostics,
pub request: CodeRetrievalRequest,
pub results: Vec<CodeRetrievalHit>,
#[serde(skip_serializing_if = "Option::is_none")]
pub degraded_reason: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RepositoryGraphNeighborhoodResponseV1 {
pub schema_version: u8,
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
pub request: RepositoryGraphNeighborhoodRequest,
pub nodes: Vec<RepositoryGraphNode>,
pub edges: Vec<RepositoryGraphEdge>,
pub truncated: bool,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CodeRepositoryFeatureFlagsResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
#[serde(default = "CodeRepositoryFreshnessDiagnostics::legacy_unknown")]
pub freshness: CodeRepositoryFreshnessDiagnostics,
pub request: CodeFeatureFlagRequest,
pub flags: Vec<CodeFeatureFlagGraph>,
#[serde(skip_serializing_if = "Option::is_none")]
pub degraded_reason: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryFrameworkGraphResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
#[serde(default = "CodeRepositoryFreshnessDiagnostics::legacy_unknown")]
pub freshness: CodeRepositoryFreshnessDiagnostics,
pub request: FrameworkGraphRequest,
pub graph: FrameworkGraph,
#[serde(skip_serializing_if = "Option::is_none")]
pub degraded_reason: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CodeRepositoryImpactResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
pub request: CodeImpactRequest,
pub path_groups: CodeImpactPathGroups,
pub results: Vec<CodeRetrievalHit>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CodeRepositoryStatusResponse {
pub metadata: ApiMetadata,
pub status: CodeRepositoryStatus,
#[serde(skip_serializing_if = "Option::is_none")]
pub active_task: Option<CodeIndexTaskRecord>,
#[serde(skip_serializing_if = "Option::is_none")]
pub checkpoint: Option<CodeIndexCheckpoint>,
pub retention: CodeScopeRetentionSummary,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CodeRepositoryReportResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
pub report: CodeRepositoryReport,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SoftwareGlobalResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
pub request: SoftwareGlobalRequest,
pub status: SoftwareGlobalStatus,
pub components: Vec<SoftwareComponent>,
pub dependency_usages: Vec<SoftwareDependencyUsage>,
pub sdk_usages: Vec<SoftwareSdkUsage>,
pub files: Vec<SoftwareFile>,
pub topics: Vec<SoftwareTopic>,
pub relationships: Vec<SoftwareRelationship>,
pub build_targets: Vec<SoftwareBuildTarget>,
pub iac_resources: Vec<SoftwareIacResource>,
pub design_elements: Vec<SoftwareDesignElement>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BusinessKnowledgeQueryResponse {
pub metadata: ApiMetadata,
pub scope: CodeRepositoryScopeMetadata,
pub request: BusinessKnowledgeQueryRequest,
pub status: BusinessKnowledgeStatus,
pub resolution: BusinessKnowledgeResolution,
pub domains: Vec<BusinessDomain>,
pub terms: Vec<BusinessTerm>,
}