quantrs2_device/provider_capability_discovery/
events.rs

1//! Events, commands, and results for provider capability discovery.
2//!
3//! This module contains discovery events, commands, comparison results,
4//! and recommendations.
5
6use std::collections::HashMap;
7use std::time::SystemTime;
8
9use serde::{Deserialize, Serialize};
10
11use super::capabilities::ProviderCapabilities;
12use super::config::{ComparisonCriterion, FilteringConfig};
13use super::types::VerificationStatus;
14
15/// Discovery events
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub enum DiscoveryEvent {
18    ProviderDiscovered {
19        provider_id: String,
20        capabilities: ProviderCapabilities,
21        timestamp: SystemTime,
22    },
23    CapabilityUpdated {
24        provider_id: String,
25        updated_capabilities: ProviderCapabilities,
26        timestamp: SystemTime,
27    },
28    ProviderUnavailable {
29        provider_id: String,
30        reason: String,
31        timestamp: SystemTime,
32    },
33    VerificationCompleted {
34        provider_id: String,
35        status: VerificationStatus,
36        timestamp: SystemTime,
37    },
38    ComparisonCompleted {
39        providers: Vec<String>,
40        results: ComparisonResults,
41        timestamp: SystemTime,
42    },
43}
44
45/// Discovery commands
46#[derive(Debug, Clone, Serialize, Deserialize)]
47pub enum DiscoveryCommand {
48    DiscoverProviders,
49    VerifyProvider(String),
50    UpdateCapabilities(String),
51    CompareProviders(Vec<String>),
52    FilterProviders(FilteringConfig),
53    GetProviderInfo(String),
54    GetProviderRanking(Vec<ComparisonCriterion>),
55    GenerateReport(ReportType),
56}
57
58/// Report types for discovery
59#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
60pub enum ReportType {
61    ProviderSummary,
62    CapabilityMatrix,
63    PerformanceComparison,
64    CostAnalysis,
65    SecurityAssessment,
66    ComprehensiveReport,
67}
68
69/// Comparison results
70#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct ComparisonResults {
72    /// Provider rankings
73    pub rankings: Vec<ProviderRanking>,
74    /// Comparison matrix
75    pub comparison_matrix: HashMap<String, HashMap<String, f64>>,
76    /// Analysis summary
77    pub analysis_summary: AnalysisSummary,
78    /// Recommendations
79    pub recommendations: Vec<ProviderRecommendation>,
80}
81
82/// Provider ranking
83#[derive(Debug, Clone, Serialize, Deserialize)]
84pub struct ProviderRanking {
85    /// Provider ID
86    pub provider_id: String,
87    /// Overall score
88    pub overall_score: f64,
89    /// Category scores
90    pub category_scores: HashMap<String, f64>,
91    /// Rank position
92    pub rank: usize,
93    /// Strengths
94    pub strengths: Vec<String>,
95    /// Weaknesses
96    pub weaknesses: Vec<String>,
97}
98
99/// Analysis summary
100#[derive(Debug, Clone, Serialize, Deserialize)]
101pub struct AnalysisSummary {
102    /// Key findings
103    pub key_findings: Vec<String>,
104    /// Market insights
105    pub market_insights: Vec<String>,
106    /// Trends identified
107    pub trends: Vec<String>,
108    /// Risk factors
109    pub risk_factors: Vec<String>,
110}
111
112/// Provider recommendation
113#[derive(Debug, Clone, Serialize, Deserialize)]
114pub struct ProviderRecommendation {
115    /// Provider ID
116    pub provider_id: String,
117    /// Recommendation type
118    pub recommendation_type: RecommendationType,
119    /// Use case
120    pub use_case: String,
121    /// Confidence score
122    pub confidence: f64,
123    /// Reasoning
124    pub reasoning: String,
125    /// Cost estimate
126    pub cost_estimate: Option<CostEstimate>,
127}
128
129/// Recommendation types
130#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
131pub enum RecommendationType {
132    BestOverall,
133    BestValue,
134    BestPerformance,
135    BestSecurity,
136    BestSupport,
137    BestForBeginners,
138    BestForResearch,
139    BestForProduction,
140    Custom(String),
141}
142
143/// Cost estimate
144#[derive(Debug, Clone, Serialize, Deserialize)]
145pub struct CostEstimate {
146    /// Estimated monthly cost
147    pub monthly_cost: f64,
148    /// Cost breakdown
149    pub cost_breakdown: HashMap<String, f64>,
150    /// Currency
151    pub currency: String,
152    /// Confidence level
153    pub confidence: f64,
154}
155
156/// Verification result
157#[derive(Debug, Clone, Serialize, Deserialize)]
158pub struct VerificationResult {
159    /// Verification status
160    pub status: VerificationStatus,
161    /// Confidence score
162    pub confidence: f64,
163    /// Verification details
164    pub details: HashMap<String, String>,
165    /// Verified at
166    pub verified_at: SystemTime,
167    /// Verification method
168    pub verification_method: String,
169}