hardware_query/
presets.rs

1//! Hardware query presets for common use cases
2//!
3//! This module provides pre-configured hardware queries for common scenarios,
4//! making it extremely easy for developers to get the information they need
5//! without having to understand all the available hardware types.
6
7use crate::{simple::SystemOverview, builder::HardwareQueryBuilder, Result};
8use serde::{Serialize, Deserialize};
9
10/// AI/ML hardware assessment result
11#[derive(Debug, Serialize, Deserialize)]
12pub struct AIHardwareAssessment {
13    /// System overview
14    pub overview: SystemOverview,
15    /// AI readiness score (0-100)
16    pub ai_score: u8,
17    /// Recommended AI frameworks
18    pub frameworks: Vec<AIFramework>,
19    /// Memory requirements for different model sizes
20    pub model_recommendations: ModelRecommendations,
21    /// Performance expectations
22    pub performance: AIPerformanceEstimate,
23    /// Optimization suggestions
24    pub optimizations: Vec<String>,
25}
26
27/// Gaming hardware assessment result
28#[derive(Debug, Serialize, Deserialize)]
29pub struct GamingHardwareAssessment {
30    /// System overview
31    pub overview: SystemOverview,
32    /// Gaming performance score (0-100)
33    pub gaming_score: u8,
34    /// Recommended game settings
35    pub recommended_settings: GameSettings,
36    /// Performance bottlenecks
37    pub bottlenecks: Vec<String>,
38    /// Upgrade recommendations
39    pub upgrade_recommendations: Vec<String>,
40}
41
42/// Developer hardware assessment result
43#[derive(Debug, Serialize, Deserialize)]
44pub struct DeveloperHardwareAssessment {
45    /// System overview
46    pub overview: SystemOverview,
47    /// Development performance score (0-100)
48    pub dev_score: u8,
49    /// Recommended development environments
50    pub environments: Vec<DevEnvironment>,
51    /// Virtualization capabilities
52    pub virtualization_support: VirtualizationSupport,
53    /// Recommended tools and configurations
54    pub tool_recommendations: Vec<String>,
55}
56
57/// Server hardware assessment result
58#[derive(Debug, Serialize, Deserialize)]
59pub struct ServerHardwareAssessment {
60    /// System overview
61    pub overview: SystemOverview,
62    /// Server performance score (0-100)
63    pub server_score: u8,
64    /// Recommended server workloads
65    pub workload_suitability: Vec<WorkloadSuitability>,
66    /// Resource allocation recommendations
67    pub resource_allocation: ResourceAllocation,
68    /// Reliability assessment
69    pub reliability: ReliabilityAssessment,
70}
71
72#[derive(Debug, Serialize, Deserialize)]
73pub struct AIFramework {
74    pub name: String,
75    pub compatibility: CompatibilityLevel,
76    pub performance_estimate: PerformanceLevel,
77    pub requirements_met: bool,
78    pub notes: String,
79}
80
81#[derive(Debug, Serialize, Deserialize)]
82pub struct ModelRecommendations {
83    pub small_models: Vec<ModelRecommendation>,
84    pub medium_models: Vec<ModelRecommendation>,
85    pub large_models: Vec<ModelRecommendation>,
86}
87
88#[derive(Debug, Serialize, Deserialize)]
89pub struct ModelRecommendation {
90    pub name: String,
91    pub parameter_count: String,
92    pub memory_required_gb: f64,
93    pub feasible: bool,
94    pub performance_estimate: PerformanceLevel,
95}
96
97#[derive(Debug, Serialize, Deserialize)]
98pub struct AIPerformanceEstimate {
99    pub training_capability: PerformanceLevel,
100    pub inference_capability: PerformanceLevel,
101    pub batch_processing: PerformanceLevel,
102    pub real_time_processing: PerformanceLevel,
103}
104
105#[derive(Debug, Serialize, Deserialize)]
106pub struct GameSettings {
107    pub resolution: String,
108    pub quality_preset: QualityLevel,
109    pub raytracing_support: bool,
110    pub target_fps: u32,
111    pub vram_usage_percent: u8,
112}
113
114#[derive(Debug, Serialize, Deserialize)]
115pub struct DevEnvironment {
116    pub name: String,
117    pub suitability: CompatibilityLevel,
118    pub container_support: bool,
119    pub vm_support: bool,
120    pub recommended_config: String,
121}
122
123#[derive(Debug, Serialize, Deserialize)]
124pub struct VirtualizationSupport {
125    pub hardware_acceleration: bool,
126    pub nested_virtualization: bool,
127    pub max_recommended_vms: u32,
128    pub docker_performance: PerformanceLevel,
129}
130
131#[derive(Debug, Serialize, Deserialize)]
132pub struct WorkloadSuitability {
133    pub workload_type: String,
134    pub suitability_score: u8,
135    pub max_concurrent_users: Option<u32>,
136    pub notes: String,
137}
138
139#[derive(Debug, Serialize, Deserialize)]
140pub struct ResourceAllocation {
141    pub recommended_vm_count: u32,
142    pub memory_per_vm_gb: f64,
143    pub cpu_cores_per_vm: u32,
144    pub storage_allocation_gb: f64,
145}
146
147#[derive(Debug, Serialize, Deserialize)]
148pub struct ReliabilityAssessment {
149    pub uptime_estimate: f64,
150    pub thermal_stability: QualityLevel,
151    pub power_stability: QualityLevel,
152    pub maintenance_requirements: Vec<String>,
153}
154
155#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
156pub enum CompatibilityLevel {
157    Excellent,
158    Good,
159    Fair,
160    Poor,
161    Incompatible,
162}
163
164#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
165pub enum PerformanceLevel {
166    Excellent,
167    Good,
168    Fair,
169    Poor,
170    Inadequate,
171}
172
173#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
174pub enum QualityLevel {
175    Ultra,
176    High,
177    Medium,
178    Low,
179    Minimum,
180}
181
182/// Hardware query presets for common use cases
183pub struct HardwarePresets;
184
185impl HardwarePresets {
186    /// Quick system overview - fastest query with most important information
187    pub fn quick_overview() -> Result<SystemOverview> {
188        SystemOverview::quick()
189    }
190
191    /// Comprehensive AI/ML hardware assessment
192    pub fn ai_assessment() -> Result<AIHardwareAssessment> {
193        let overview = SystemOverview::quick()?;
194        let ai_score = overview.ai_score();
195        
196        let frameworks = Self::assess_ai_frameworks(&overview);
197        let model_recommendations = Self::get_model_recommendations(&overview);
198        let performance = Self::estimate_ai_performance(&overview);
199        let optimizations = Self::get_ai_optimizations(&overview);
200
201        Ok(AIHardwareAssessment {
202            overview,
203            ai_score,
204            frameworks,
205            model_recommendations,
206            performance,
207            optimizations,
208        })
209    }
210
211    /// Gaming hardware assessment and recommendations
212    pub fn gaming_assessment() -> Result<GamingHardwareAssessment> {
213        let _hw_info = HardwareQueryBuilder::new()
214            .with_gaming_focused()
215            .query()?;
216        
217        let overview = SystemOverview::quick()?;
218        let gaming_score = Self::calculate_gaming_score(&overview);
219        let recommended_settings = Self::get_game_settings(&overview);
220        let bottlenecks = Self::identify_gaming_bottlenecks(&overview);
221        let upgrade_recommendations = Self::get_gaming_upgrades(&overview);
222
223        Ok(GamingHardwareAssessment {
224            overview,
225            gaming_score,
226            recommended_settings,
227            bottlenecks,
228            upgrade_recommendations,
229        })
230    }
231
232    /// Developer workstation assessment
233    pub fn developer_assessment() -> Result<DeveloperHardwareAssessment> {
234        let overview = SystemOverview::quick()?;
235        let dev_score = Self::calculate_dev_score(&overview);
236        let environments = Self::assess_dev_environments(&overview);
237        let virtualization_support = Self::assess_virtualization(&overview);
238        let tool_recommendations = Self::get_dev_tool_recommendations(&overview);
239
240        Ok(DeveloperHardwareAssessment {
241            overview,
242            dev_score,
243            environments,
244            virtualization_support,
245            tool_recommendations,
246        })
247    }
248
249    /// Server hardware assessment
250    pub fn server_assessment() -> Result<ServerHardwareAssessment> {
251        let _hw_info = HardwareQueryBuilder::new()
252            .with_server_focused()
253            .query()?;
254        
255        let overview = SystemOverview::quick()?;
256        let server_score = Self::calculate_server_score(&overview);
257        let workload_suitability = Self::assess_server_workloads(&overview);
258        let resource_allocation = Self::recommend_resource_allocation(&overview);
259        let reliability = Self::assess_reliability(&overview);
260
261        Ok(ServerHardwareAssessment {
262            overview,
263            server_score,
264            workload_suitability,
265            resource_allocation,
266            reliability,
267        })
268    }
269
270    /// Check if system is ready for a specific AI model
271    pub fn check_ai_model_compatibility(_model_name: &str, _params: &str, memory_gb: f64) -> Result<bool> {
272        let overview = SystemOverview::quick()?;
273        
274        // Simple compatibility check
275        let available_memory = if let Some(gpu) = &overview.gpu {
276            gpu.vram_gb
277        } else {
278            overview.memory_gb * 0.7 // Assume 70% of system RAM is available
279        };
280
281        Ok(available_memory >= memory_gb && overview.is_ai_ready())
282    }
283
284    /// Get quick gaming performance estimate
285    pub fn gaming_fps_estimate(resolution: &str, quality: &str) -> Result<u32> {
286        let overview = SystemOverview::quick()?;
287        
288        // Simple FPS estimation based on hardware
289        let base_fps = if let Some(gpu) = &overview.gpu {
290            if gpu.vram_gb >= 8.0 {
291                120
292            } else if gpu.vram_gb >= 4.0 {
293                80
294            } else {
295                30
296            }
297        } else {
298            15
299        };
300
301        // Apply resolution and quality modifiers
302        let resolution_modifier = match resolution {
303            "1080p" => 1.0,
304            "1440p" => 0.7,
305            "4K" => 0.4,
306            _ => 1.0,
307        };
308
309        let quality_modifier = match quality {
310            "Low" => 1.2,
311            "Medium" => 1.0,
312            "High" => 0.8,
313            "Ultra" => 0.6,
314            _ => 1.0,
315        };
316
317        let estimated_fps = (base_fps as f64 * resolution_modifier * quality_modifier) as u32;
318        Ok(estimated_fps.max(15)) // Minimum 15 FPS
319    }
320
321    // Private implementation methods
322    fn assess_ai_frameworks(overview: &SystemOverview) -> Vec<AIFramework> {
323        let mut frameworks = Vec::new();
324
325        // PyTorch
326        frameworks.push(AIFramework {
327            name: "PyTorch".to_string(),
328            compatibility: if overview.gpu.is_some() { 
329                CompatibilityLevel::Excellent 
330            } else { 
331                CompatibilityLevel::Good 
332            },
333            performance_estimate: if overview.gpu.as_ref().map_or(false, |g| g.ai_capable) {
334                PerformanceLevel::Excellent
335            } else {
336                PerformanceLevel::Fair
337            },
338            requirements_met: overview.memory_gb >= 4.0,
339            notes: "Popular deep learning framework with excellent GPU support".to_string(),
340        });
341
342        // TensorFlow
343        frameworks.push(AIFramework {
344            name: "TensorFlow".to_string(),
345            compatibility: if overview.gpu.is_some() { 
346                CompatibilityLevel::Excellent 
347            } else { 
348                CompatibilityLevel::Good 
349            },
350            performance_estimate: if overview.gpu.as_ref().map_or(false, |g| g.ai_capable) {
351                PerformanceLevel::Excellent
352            } else {
353                PerformanceLevel::Fair
354            },
355            requirements_met: overview.memory_gb >= 4.0,
356            notes: "Google's ML framework with strong production support".to_string(),
357        });
358
359        // ONNX Runtime
360        frameworks.push(AIFramework {
361            name: "ONNX Runtime".to_string(),
362            compatibility: CompatibilityLevel::Excellent,
363            performance_estimate: PerformanceLevel::Good,
364            requirements_met: true,
365            notes: "Cross-platform inference with broad hardware support".to_string(),
366        });
367
368        frameworks
369    }
370
371    fn get_model_recommendations(overview: &SystemOverview) -> ModelRecommendations {
372        let available_vram = overview.gpu.as_ref().map_or(0.0, |g| g.vram_gb);
373        let available_ram = overview.memory_gb;
374
375        ModelRecommendations {
376            small_models: vec![
377                ModelRecommendation {
378                    name: "BERT-base".to_string(),
379                    parameter_count: "110M".to_string(),
380                    memory_required_gb: 1.0,
381                    feasible: available_vram >= 1.0 || available_ram >= 2.0,
382                    performance_estimate: PerformanceLevel::Excellent,
383                },
384                ModelRecommendation {
385                    name: "DistilBERT".to_string(),
386                    parameter_count: "66M".to_string(),
387                    memory_required_gb: 0.5,
388                    feasible: true,
389                    performance_estimate: PerformanceLevel::Excellent,
390                },
391            ],
392            medium_models: vec![
393                ModelRecommendation {
394                    name: "GPT-3.5".to_string(),
395                    parameter_count: "175B".to_string(),
396                    memory_required_gb: 8.0,
397                    feasible: available_vram >= 8.0,
398                    performance_estimate: if available_vram >= 8.0 { 
399                        PerformanceLevel::Good 
400                    } else { 
401                        PerformanceLevel::Poor 
402                    },
403                },
404            ],
405            large_models: vec![
406                ModelRecommendation {
407                    name: "GPT-4".to_string(),
408                    parameter_count: "1.7T".to_string(),
409                    memory_required_gb: 80.0,
410                    feasible: available_vram >= 80.0,
411                    performance_estimate: if available_vram >= 80.0 { 
412                        PerformanceLevel::Fair 
413                    } else { 
414                        PerformanceLevel::Inadequate 
415                    },
416                },
417            ],
418        }
419    }
420
421    fn estimate_ai_performance(overview: &SystemOverview) -> AIPerformanceEstimate {
422        let has_gpu = overview.gpu.is_some();
423        let gpu_ai_capable = overview.gpu.as_ref().map_or(false, |g| g.ai_capable);
424        let sufficient_memory = overview.memory_gb >= 16.0;
425
426        AIPerformanceEstimate {
427            training_capability: if gpu_ai_capable && sufficient_memory {
428                PerformanceLevel::Good
429            } else if has_gpu {
430                PerformanceLevel::Fair
431            } else {
432                PerformanceLevel::Poor
433            },
434            inference_capability: if gpu_ai_capable {
435                PerformanceLevel::Excellent
436            } else if has_gpu {
437                PerformanceLevel::Good
438            } else {
439                PerformanceLevel::Fair
440            },
441            batch_processing: if gpu_ai_capable && sufficient_memory {
442                PerformanceLevel::Excellent
443            } else {
444                PerformanceLevel::Fair
445            },
446            real_time_processing: if gpu_ai_capable {
447                PerformanceLevel::Good
448            } else {
449                PerformanceLevel::Fair
450            },
451        }
452    }
453
454    fn get_ai_optimizations(overview: &SystemOverview) -> Vec<String> {
455        let mut optimizations = Vec::new();
456
457        if overview.gpu.is_none() {
458            optimizations.push("Consider adding a dedicated GPU for AI acceleration".to_string());
459        }
460
461        if overview.memory_gb < 16.0 {
462            optimizations.push("Increase system RAM to 16GB+ for better model performance".to_string());
463        }
464
465        if let Some(gpu) = &overview.gpu {
466            if gpu.vram_gb < 8.0 {
467                optimizations.push("Consider GPU with more VRAM for larger models".to_string());
468            }
469        }
470
471        optimizations.extend(overview.get_recommendations());
472        optimizations
473    }
474
475    fn calculate_gaming_score(overview: &SystemOverview) -> u8 {
476        let mut score = 0;
477
478        // GPU is most important for gaming (60 points)
479        if let Some(gpu) = &overview.gpu {
480            if gpu.vram_gb >= 12.0 {
481                score += 60;
482            } else if gpu.vram_gb >= 8.0 {
483                score += 50;
484            } else if gpu.vram_gb >= 6.0 {
485                score += 40;
486            } else if gpu.vram_gb >= 4.0 {
487                score += 30;
488            } else {
489                score += 15;
490            }
491        }
492
493        // CPU (25 points)
494        if overview.cpu.cores >= 8 {
495            score += 25;
496        } else if overview.cpu.cores >= 6 {
497            score += 20;
498        } else if overview.cpu.cores >= 4 {
499            score += 15;
500        } else {
501            score += 5;
502        }
503
504        // Memory (15 points)
505        if overview.memory_gb >= 32.0 {
506            score += 15;
507        } else if overview.memory_gb >= 16.0 {
508            score += 12;
509        } else if overview.memory_gb >= 8.0 {
510            score += 8;
511        } else {
512            score += 3;
513        }
514
515        score.min(100)
516    }
517
518    fn get_game_settings(overview: &SystemOverview) -> GameSettings {
519        let vram = overview.gpu.as_ref().map_or(0.0, |g| g.vram_gb);
520        
521        let (resolution, quality, target_fps) = if vram >= 12.0 {
522            ("4K", QualityLevel::Ultra, 60)
523        } else if vram >= 8.0 {
524            ("1440p", QualityLevel::High, 75)
525        } else if vram >= 6.0 {
526            ("1080p", QualityLevel::High, 60)
527        } else if vram >= 4.0 {
528            ("1080p", QualityLevel::Medium, 60)
529        } else {
530            ("1080p", QualityLevel::Low, 30)
531        };
532
533        GameSettings {
534            resolution: resolution.to_string(),
535            quality_preset: quality,
536            raytracing_support: vram >= 8.0,
537            target_fps,
538            vram_usage_percent: 85,
539        }
540    }
541
542    fn identify_gaming_bottlenecks(overview: &SystemOverview) -> Vec<String> {
543        let mut bottlenecks = Vec::new();
544
545        if overview.gpu.is_none() {
546            bottlenecks.push("No dedicated GPU - severely limits gaming performance".to_string());
547        } else if let Some(gpu) = &overview.gpu {
548            if gpu.vram_gb < 4.0 {
549                bottlenecks.push("Low GPU VRAM limits texture quality and resolution".to_string());
550            }
551        }
552
553        if overview.cpu.cores < 4 {
554            bottlenecks.push("Low CPU core count may limit performance in modern games".to_string());
555        }
556
557        if overview.memory_gb < 16.0 {
558            bottlenecks.push("Low system RAM may cause stuttering in memory-intensive games".to_string());
559        }
560
561        if overview.storage.drive_type.to_lowercase().contains("hdd") {
562            bottlenecks.push("HDD storage may cause slow loading times".to_string());
563        }
564
565        bottlenecks
566    }
567
568    fn get_gaming_upgrades(overview: &SystemOverview) -> Vec<String> {
569        let mut upgrades = Vec::new();
570
571        if let Some(gpu) = &overview.gpu {
572            if gpu.vram_gb < 8.0 {
573                upgrades.push("Upgrade to GPU with 8GB+ VRAM for modern games".to_string());
574            }
575        } else {
576            upgrades.push("Add dedicated gaming GPU".to_string());
577        }
578
579        if overview.memory_gb < 16.0 {
580            upgrades.push("Upgrade to 16GB+ RAM".to_string());
581        }
582
583        if overview.storage.drive_type.to_lowercase().contains("hdd") {
584            upgrades.push("Upgrade to NVMe SSD for faster loading".to_string());
585        }
586
587        upgrades
588    }
589
590    fn calculate_dev_score(overview: &SystemOverview) -> u8 {
591        let mut score = 0;
592
593        // CPU is crucial for development (40 points)
594        if overview.cpu.cores >= 16 {
595            score += 40;
596        } else if overview.cpu.cores >= 8 {
597            score += 35;
598        } else if overview.cpu.cores >= 6 {
599            score += 25;
600        } else {
601            score += 15;
602        }
603
604        // Memory for IDEs and build tools (35 points)
605        if overview.memory_gb >= 32.0 {
606            score += 35;
607        } else if overview.memory_gb >= 16.0 {
608            score += 25;
609        } else if overview.memory_gb >= 8.0 {
610            score += 15;
611        } else {
612            score += 5;
613        }
614
615        // Storage for fast builds (25 points)
616        if overview.storage.drive_type.to_lowercase().contains("nvme") {
617            score += 25;
618        } else if overview.storage.drive_type.to_lowercase().contains("ssd") {
619            score += 20;
620        } else {
621            score += 10;
622        }
623
624        score.min(100)
625    }
626
627    fn assess_dev_environments(overview: &SystemOverview) -> Vec<DevEnvironment> {
628        vec![
629            DevEnvironment {
630                name: "Visual Studio Code".to_string(),
631                suitability: CompatibilityLevel::Excellent,
632                container_support: true,
633                vm_support: false,
634                recommended_config: "Lightweight, excellent for most development tasks".to_string(),
635            },
636            DevEnvironment {
637                name: "Docker Desktop".to_string(),
638                suitability: if overview.memory_gb >= 8.0 { 
639                    CompatibilityLevel::Excellent 
640                } else { 
641                    CompatibilityLevel::Fair 
642                },
643                container_support: true,
644                vm_support: true,
645                recommended_config: "Requires 8GB+ RAM for optimal performance".to_string(),
646            },
647            DevEnvironment {
648                name: "IntelliJ IDEA".to_string(),
649                suitability: if overview.memory_gb >= 16.0 { 
650                    CompatibilityLevel::Excellent 
651                } else { 
652                    CompatibilityLevel::Good 
653                },
654                container_support: true,
655                vm_support: false,
656                recommended_config: "Heavy IDE, benefits from 16GB+ RAM".to_string(),
657            },
658        ]
659    }
660
661    fn assess_virtualization(overview: &SystemOverview) -> VirtualizationSupport {
662        let hardware_acceleration = overview.cpu.cores >= 4;
663        let nested_virtualization = overview.cpu.cores >= 8;
664        let max_vms = if overview.memory_gb >= 32.0 { 4 } else if overview.memory_gb >= 16.0 { 2 } else { 1 };
665        let docker_performance = if overview.memory_gb >= 16.0 { 
666            PerformanceLevel::Excellent 
667        } else { 
668            PerformanceLevel::Good 
669        };
670
671        VirtualizationSupport {
672            hardware_acceleration,
673            nested_virtualization,
674            max_recommended_vms: max_vms,
675            docker_performance,
676        }
677    }
678
679    fn get_dev_tool_recommendations(overview: &SystemOverview) -> Vec<String> {
680        let mut recommendations = Vec::new();
681
682        recommendations.push("Git for version control".to_string());
683        
684        if overview.memory_gb >= 16.0 {
685            recommendations.push("Docker for containerized development".to_string());
686        }
687        
688        if overview.cpu.cores >= 8 {
689            recommendations.push("Parallel build tools (ninja, etc.)".to_string());
690        }
691        
692        recommendations.push("Terminal with good performance (Windows Terminal, iTerm2)".to_string());
693        
694        recommendations
695    }
696
697    fn calculate_server_score(overview: &SystemOverview) -> u8 {
698        // Server scoring focuses on stability, multiple cores, and adequate memory
699        let mut score = 0;
700
701        // CPU cores for concurrent handling (40 points)
702        if overview.cpu.cores >= 32 {
703            score += 40;
704        } else if overview.cpu.cores >= 16 {
705            score += 35;
706        } else if overview.cpu.cores >= 8 {
707            score += 25;
708        } else {
709            score += 10;
710        }
711
712        // Memory for server applications (35 points)
713        if overview.memory_gb >= 64.0 {
714            score += 35;
715        } else if overview.memory_gb >= 32.0 {
716            score += 25;
717        } else if overview.memory_gb >= 16.0 {
718            score += 15;
719        } else {
720            score += 5;
721        }
722
723        // Storage reliability and speed (25 points)
724        if overview.storage.drive_type.to_lowercase().contains("nvme") {
725            score += 25;
726        } else if overview.storage.drive_type.to_lowercase().contains("ssd") {
727            score += 20;
728        } else {
729            score += 10;
730        }
731
732        score.min(100)
733    }
734
735    fn assess_server_workloads(overview: &SystemOverview) -> Vec<WorkloadSuitability> {
736        vec![
737            WorkloadSuitability {
738                workload_type: "Web Server".to_string(),
739                suitability_score: if overview.cpu.cores >= 8 { 90 } else { 70 },
740                max_concurrent_users: Some(overview.cpu.cores * 100),
741                notes: "Good for serving web applications".to_string(),
742            },
743            WorkloadSuitability {
744                workload_type: "Database Server".to_string(),
745                suitability_score: if overview.memory_gb >= 32.0 { 85 } else { 60 },
746                max_concurrent_users: Some((overview.memory_gb as u32) * 10),
747                notes: "Memory-intensive workload".to_string(),
748            },
749            WorkloadSuitability {
750                workload_type: "Container Orchestration".to_string(),
751                suitability_score: if overview.cpu.cores >= 16 && overview.memory_gb >= 32.0 { 95 } else { 70 },
752                max_concurrent_users: None,
753                notes: "Requires high CPU and memory for container management".to_string(),
754            },
755        ]
756    }
757
758    fn recommend_resource_allocation(overview: &SystemOverview) -> ResourceAllocation {
759        let vm_count = if overview.memory_gb >= 64.0 { 8 } else if overview.memory_gb >= 32.0 { 4 } else { 2 };
760        let memory_per_vm = (overview.memory_gb * 0.8) / (vm_count as f64);
761        let cores_per_vm = overview.cpu.cores / vm_count;
762        let storage_per_vm = overview.storage.total_gb * 0.7 / (vm_count as f64);
763
764        ResourceAllocation {
765            recommended_vm_count: vm_count,
766            memory_per_vm_gb: memory_per_vm,
767            cpu_cores_per_vm: cores_per_vm,
768            storage_allocation_gb: storage_per_vm,
769        }
770    }
771
772    fn assess_reliability(overview: &SystemOverview) -> ReliabilityAssessment {
773        let thermal_stability = match overview.health.temperature {
774            crate::simple::TemperatureStatus::Normal => QualityLevel::High,
775            crate::simple::TemperatureStatus::Warm => QualityLevel::Medium,
776            crate::simple::TemperatureStatus::Hot => QualityLevel::Low,
777            crate::simple::TemperatureStatus::Critical => QualityLevel::Minimum,
778        };
779
780        let power_stability = match overview.health.power {
781            crate::simple::PowerStatus::Low | crate::simple::PowerStatus::Normal => QualityLevel::High,
782            crate::simple::PowerStatus::High => QualityLevel::Medium,
783            crate::simple::PowerStatus::VeryHigh => QualityLevel::Low,
784        };
785
786        let uptime_estimate = match overview.health.status {
787            crate::simple::HealthStatus::Excellent => 99.9,
788            crate::simple::HealthStatus::Good => 99.5,
789            crate::simple::HealthStatus::Fair => 99.0,
790            crate::simple::HealthStatus::Poor => 98.0,
791            crate::simple::HealthStatus::Critical => 95.0,
792        };
793
794        ReliabilityAssessment {
795            uptime_estimate,
796            thermal_stability,
797            power_stability,
798            maintenance_requirements: overview.health.warnings.clone(),
799        }
800    }
801}