quantrs2-device 0.1.3

Quantum device connectors for the QuantRS2 framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
//! Cloud Orchestration and Load Balancing Configuration
//!
//! This module provides comprehensive configuration structures for cloud orchestration,
//! including performance optimization, load balancing, security, and budget management.
//!
//! The module is organized into focused sub-modules for better maintainability:
//! - `performance`: Performance optimization and QoS configurations
//! - `load_balancing`: Load balancing and traffic management
//! - `security`: Security, authentication, and compliance
//! - `budget`: Budget management and cost tracking
//! - `defaults`: Default implementations for all configurations

pub mod load_balancing;
pub mod performance;

// TODO: Create dedicated modules for security and budget
// pub mod security;
// pub mod budget;
// pub mod defaults;

// Re-export all types for backward compatibility
pub use load_balancing::*;
pub use performance::*;

// Note: security and budget modules need to be created
// For now, we'll need to keep the remaining types in this file temporarily

use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::time::Duration;

/// Cloud security configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CloudSecurityConfig {
    /// Authentication configuration
    pub authentication: AuthenticationConfig,
    /// Authorization configuration
    pub authorization: AuthorizationConfig,
    /// Encryption configuration
    pub encryption: EncryptionConfig,
    /// Network security
    pub network_security: NetworkSecurityConfig,
    /// Compliance configuration
    pub compliance: ComplianceConfig,
}

// Include all the security-related types temporarily
/// Authentication configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthenticationConfig {
    /// Authentication methods
    pub methods: Vec<AuthMethod>,
    /// Multi-factor authentication
    pub mfa: MFAConfig,
    /// Single sign-on
    pub sso: SSOConfig,
}

/// Authentication methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AuthMethod {
    Password,
    APIKey,
    Certificate,
    OAuth2,
    SAML,
    Custom(String),
}

/// MFA configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MFAConfig {
    /// Enable MFA
    pub enabled: bool,
    /// MFA methods
    pub methods: Vec<MFAMethod>,
    /// Backup codes
    pub backup_codes: bool,
}

/// MFA methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum MFAMethod {
    TOTP,
    SMS,
    Email,
    PushNotification,
    Hardware,
}

/// SSO configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SSOConfig {
    /// Enable SSO
    pub enabled: bool,
    /// SSO provider
    pub provider: SSOProvider,
    /// SAML configuration
    pub saml: SAMLConfig,
    /// OIDC configuration
    pub oidc: OIDCConfig,
}

/// SSO providers
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum SSOProvider {
    SAML,
    OIDC,
    LDAP,
    ActiveDirectory,
    Custom(String),
}

/// SAML configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SAMLConfig {
    /// Identity provider URL
    pub idp_url: String,
    /// Service provider ID
    pub sp_id: String,
    /// Certificate
    pub certificate: String,
}

/// OIDC configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct OIDCConfig {
    /// Client ID
    pub client_id: String,
    /// Client secret
    pub client_secret: String,
    /// Discovery URL
    pub discovery_url: String,
}

/// Authorization configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthorizationConfig {
    /// Authorization model
    pub model: AuthorizationModel,
    /// Role definitions
    pub roles: Vec<RoleDefinition>,
    /// Permission system
    pub permissions: PermissionSystem,
}

/// Authorization models
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AuthorizationModel {
    RBAC,
    ABAC,
    DAC,
    MAC,
    Custom(String),
}

/// Role definition
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RoleDefinition {
    /// Role name
    pub name: String,
    /// Description
    pub description: String,
    /// Permissions
    pub permissions: Vec<String>,
    /// Role hierarchy
    pub parent_roles: Vec<String>,
}

/// Permission system
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PermissionSystem {
    /// Permission model
    pub model: PermissionModel,
    /// Resource definitions
    pub resources: Vec<ResourceDefinition>,
    /// Action definitions
    pub actions: Vec<ActionDefinition>,
}

/// Permission models
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum PermissionModel {
    ResourceAction,
    CapabilityBased,
    AttributeBased,
    Custom(String),
}

/// Resource definition
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ResourceDefinition {
    /// Resource type
    pub resource_type: String,
    /// Resource attributes
    pub attributes: HashMap<String, String>,
    /// Access patterns
    pub access_patterns: Vec<AccessPattern>,
}

/// Access pattern
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccessPattern {
    /// Pattern name
    pub name: String,
    /// Allowed actions
    pub actions: Vec<String>,
    /// Conditions
    pub conditions: Vec<AccessCondition>,
}

/// Access condition
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AccessCondition {
    /// Attribute
    pub attribute: String,
    /// Operator
    pub operator: String,
    /// Value
    pub value: String,
}

/// Action definition
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ActionDefinition {
    /// Action name
    pub name: String,
    /// Description
    pub description: String,
    /// Required permissions
    pub required_permissions: Vec<String>,
}

/// Encryption configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionConfig {
    /// Encryption at rest
    pub at_rest: EncryptionAtRestConfig,
    /// Encryption in transit
    pub in_transit: EncryptionInTransitConfig,
    /// Key management
    pub key_management: EncryptionKeyManagementConfig,
}

/// Encryption at rest configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionAtRestConfig {
    /// Enable encryption
    pub enabled: bool,
    /// Encryption algorithm
    pub algorithm: String,
    /// Key size
    pub key_size: usize,
}

/// Encryption in transit configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionInTransitConfig {
    /// Enable encryption
    pub enabled: bool,
    /// TLS version
    pub tls_version: String,
    /// Cipher suites
    pub cipher_suites: Vec<String>,
}

/// Encryption key management configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionKeyManagementConfig {
    /// Key management service
    pub service: KeyManagementService,
    /// Key rotation policy
    pub rotation_policy: EncryptionKeyRotationPolicy,
    /// Key backup policy
    pub backup_policy: EncryptionKeyBackupPolicy,
}

/// Key management services
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum KeyManagementService {
    AwsKms,
    AzureKeyVault,
    GoogleKms,
    HashiCorpVault,
    Custom(String),
}

/// Key rotation policy
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionKeyRotationPolicy {
    /// Enable rotation
    pub enabled: bool,
    /// Rotation frequency
    pub frequency: Duration,
    /// Automatic rotation
    pub automatic: bool,
}

/// Key backup policy
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct EncryptionKeyBackupPolicy {
    /// Enable backup
    pub enabled: bool,
    /// Backup frequency
    pub frequency: Duration,
    /// Backup locations
    pub locations: Vec<String>,
}

/// Network security configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NetworkSecurityConfig {
    /// Firewall configuration
    pub firewall: FirewallConfig,
    /// VPN configuration
    pub vpn: VPNConfig,
    /// DDoS protection
    pub ddos_protection: DDoSProtectionConfig,
}

/// Firewall configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FirewallConfig {
    /// Enable firewall
    pub enabled: bool,
    /// Firewall rules
    pub rules: Vec<FirewallRule>,
    /// Default policy
    pub default_policy: FirewallPolicy,
}

/// Firewall rule
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FirewallRule {
    /// Rule name
    pub name: String,
    /// Source
    pub source: String,
    /// Destination
    pub destination: String,
    /// Port
    pub port: String,
    /// Protocol
    pub protocol: String,
    /// Action
    pub action: FirewallAction,
}

/// Firewall policies
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum FirewallPolicy {
    Allow,
    Deny,
    Log,
}

/// Firewall actions
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum FirewallAction {
    Allow,
    Deny,
    Log,
}

/// VPN configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VPNConfig {
    /// Enable VPN
    pub enabled: bool,
    /// VPN type
    pub vpn_type: VPNType,
    /// Connection settings
    pub connection: VPNConnectionConfig,
}

/// VPN types
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum VPNType {
    SiteToSite,
    PointToSite,
    PointToPoint,
    Custom(String),
}

/// VPN connection configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VPNConnectionConfig {
    /// Gateway address
    pub gateway: String,
    /// Pre-shared key
    pub psk: String,
    /// Encryption
    pub encryption: String,
}

/// DDoS protection configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DDoSProtectionConfig {
    /// Enable protection
    pub enabled: bool,
    /// Protection level
    pub level: DDoSProtectionLevel,
    /// Rate limiting
    pub rate_limiting: RateLimitingConfig,
}

/// DDoS protection levels
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum DDoSProtectionLevel {
    Basic,
    Standard,
    Premium,
    Custom(String),
}

/// Rate limiting configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RateLimitingConfig {
    /// Enable rate limiting
    pub enabled: bool,
    /// Request limits
    pub limits: HashMap<String, usize>,
    /// Time windows
    pub windows: HashMap<String, Duration>,
}

/// Compliance configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ComplianceConfig {
    /// Compliance frameworks
    pub frameworks: Vec<ComplianceFramework>,
    /// Audit configuration
    pub audit: AuditConfig,
    /// Data governance
    pub data_governance: DataGovernanceConfig,
}

/// Compliance frameworks
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ComplianceFramework {
    SOC2,
    ISO27001,
    GDPR,
    HIPAA,
    PciDss,
    Custom(String),
}

/// Audit configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuditConfig {
    /// Enable auditing
    pub enabled: bool,
    /// Audit events
    pub events: Vec<AuditEvent>,
    /// Log retention
    pub retention: Duration,
}

/// Audit events
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AuditEvent {
    Authentication,
    Authorization,
    DataAccess,
    ConfigChange,
    SecurityEvent,
    Custom(String),
}

/// Data governance configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataGovernanceConfig {
    /// Data classification
    pub classification: DataClassificationConfig,
    /// Data retention
    pub retention: DataRetentionConfig,
    /// Data privacy
    pub privacy: DataPrivacyConfig,
}

/// Data classification configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataClassificationConfig {
    /// Classification levels
    pub levels: Vec<ClassificationLevel>,
    /// Auto-classification
    pub auto_classification: bool,
}

/// Classification level
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClassificationLevel {
    /// Level name
    pub name: String,
    /// Sensitivity score
    pub sensitivity: u8,
    /// Handling requirements
    pub requirements: Vec<String>,
}

/// Data retention configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataRetentionConfig {
    /// Retention policies
    pub policies: Vec<RetentionPolicy>,
    /// Default retention
    pub default_retention: Duration,
}

/// Retention policy
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RetentionPolicy {
    /// Data type
    pub data_type: String,
    /// Retention period
    pub retention_period: Duration,
    /// Disposal method
    pub disposal_method: DisposalMethod,
}

/// Disposal methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum DisposalMethod {
    Delete,
    Archive,
    Anonymize,
    Custom(String),
}

/// Data privacy configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DataPrivacyConfig {
    /// Privacy controls
    pub controls: Vec<PrivacyControl>,
    /// Consent management
    pub consent: ConsentManagementConfig,
}

/// Privacy controls
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum PrivacyControl {
    Anonymization,
    Pseudonymization,
    DataMinimization,
    AccessControl,
    Custom(String),
}

/// Consent management configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConsentManagementConfig {
    /// Enable consent management
    pub enabled: bool,
    /// Consent types
    pub consent_types: Vec<String>,
    /// Withdrawal process
    pub withdrawal_process: WithdrawalProcess,
}

/// Withdrawal process
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WithdrawalProcess {
    /// Methods available
    pub methods: Vec<WithdrawalMethod>,
    /// Processing time
    pub processing_time: Duration,
    /// Confirmation required
    pub confirmation_required: bool,
}

/// Withdrawal methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum WithdrawalMethod {
    Online,
    Email,
    Phone,
    Mail,
    Custom(String),
}

/// Budget management configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BudgetManagementConfig {
    /// Global budget settings
    pub global_budget: GlobalBudgetConfig,
    /// Department budgets
    pub department_budgets: HashMap<String, DepartmentBudgetConfig>,
    /// Project budgets
    pub project_budgets: HashMap<String, ProjectBudgetConfig>,
    /// Budget monitoring
    pub monitoring: BudgetMonitoringConfig,
}

/// Global budget configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GlobalBudgetConfig {
    /// Total budget
    pub total_budget: f64,
    /// Budget period
    pub period: BudgetPeriod,
    /// Currency
    pub currency: String,
    /// Rollover policy
    pub rollover_policy: RolloverPolicy,
}

/// Budget periods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum BudgetPeriod {
    Monthly,
    Quarterly,
    Annual,
    Custom(Duration),
}

/// Rollover policies
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum RolloverPolicy {
    NoRollover,
    FullRollover,
    PartialRollover(f64),
    ConditionalRollover,
}

/// Department budget configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DepartmentBudgetConfig {
    /// Department name
    pub name: String,
    /// Allocated budget
    pub allocated_budget: f64,
    /// Spending limits
    pub spending_limits: SpendingLimits,
    /// Approval workflow
    pub approval_workflow: BudgetApprovalWorkflow,
}

/// Spending limits
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SpendingLimits {
    /// Daily limit
    pub daily_limit: Option<f64>,
    /// Weekly limit
    pub weekly_limit: Option<f64>,
    /// Monthly limit
    pub monthly_limit: Option<f64>,
    /// Per-transaction limit
    pub per_transaction_limit: Option<f64>,
}

/// Budget approval workflow
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BudgetApprovalWorkflow {
    /// Approval levels
    pub levels: Vec<BudgetApprovalLevel>,
    /// Auto-approval thresholds
    pub auto_approval_thresholds: HashMap<String, f64>,
    /// Escalation timeouts
    pub escalation_timeouts: HashMap<String, Duration>,
}

/// Budget approval level
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BudgetApprovalLevel {
    /// Level name
    pub name: String,
    /// Approvers
    pub approvers: Vec<String>,
    /// Spending thresholds
    pub thresholds: HashMap<String, f64>,
}

/// Project budget configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectBudgetConfig {
    /// Project name
    pub name: String,
    /// Project budget
    pub budget: f64,
    /// Cost tracking
    pub cost_tracking: ProjectCostTracking,
    /// Budget alerts
    pub alerts: ProjectBudgetAlerts,
}

/// Project cost tracking
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectCostTracking {
    /// Granularity
    pub granularity: CostTrackingGranularity,
    /// Cost categories
    pub categories: Vec<CostCategory>,
    /// Allocation rules
    pub allocation_rules: Vec<CostAllocationRule>,
}

/// Cost tracking granularity
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum CostTrackingGranularity {
    Hourly,
    Daily,
    Weekly,
    Monthly,
}

/// Cost category
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CostCategory {
    /// Category name
    pub name: String,
    /// Description
    pub description: String,
    /// Budget allocation
    pub budget_allocation: f64,
}

/// Cost allocation rule
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CostAllocationRule {
    /// Rule name
    pub name: String,
    /// Source category
    pub source: String,
    /// Target category
    pub target: String,
    /// Allocation percentage
    pub percentage: f64,
}

/// Project budget alerts
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectBudgetAlerts {
    /// Alert thresholds
    pub thresholds: Vec<f64>,
    /// Alert recipients
    pub recipients: Vec<String>,
    /// Alert frequency
    pub frequency: AlertFrequency,
}

/// Alert frequency
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum AlertFrequency {
    Immediate,
    Daily,
    Weekly,
    OnThreshold,
}

/// Budget monitoring configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BudgetMonitoringConfig {
    /// Real-time monitoring
    pub real_time: bool,
    /// Reporting frequency
    pub reporting_frequency: ReportingFrequency,
    /// Variance analysis
    pub variance_analysis: BudgetVarianceAnalysis,
    /// Forecasting
    pub forecasting: BudgetForecastingConfig,
}

/// Reporting frequency
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ReportingFrequency {
    RealTime,
    Hourly,
    Daily,
    Weekly,
    Monthly,
}

/// Budget variance analysis
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BudgetVarianceAnalysis {
    /// Enable analysis
    pub enabled: bool,
    /// Variance thresholds
    pub thresholds: BudgetVarianceThresholds,
    /// Analysis methods
    pub methods: Vec<VarianceAnalysisMethod>,
}

/// Budget variance thresholds
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BudgetVarianceThresholds {
    /// Warning threshold
    pub warning: f64,
    /// Critical threshold
    pub critical: f64,
    /// Emergency threshold
    pub emergency: f64,
}

/// Variance analysis methods
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum VarianceAnalysisMethod {
    AbsoluteVariance,
    PercentageVariance,
    TrendAnalysis,
    SeasonalAnalysis,
}

/// Budget forecasting configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BudgetForecastingConfig {
    /// Enable forecasting
    pub enabled: bool,
    /// Forecasting models
    pub models: Vec<BudgetForecastingModel>,
    /// Forecast horizon
    pub horizon: Duration,
    /// Update frequency
    pub update_frequency: Duration,
}

/// Budget forecasting models
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum BudgetForecastingModel {
    LinearTrend,
    ExponentialSmoothing,
    ARIMA,
    MachineLearning,
    Custom(String),
}