4040//! | [`audit`] | Audit trail and compliance reporting |
4141//! | [`atomic_swap`] | Cross-chain atomic swaps |
4242//! | [`analytics`] | Bridge monitoring and analytics |
43+ //! | [`reporting`] | Advanced analytics, report templates, dashboards, and alerting |
4344//! | [`rewards`] | Reward pool management and distribution |
4445//! | [`escrow`] | Multi-signature escrow with dispute resolution |
4546//! | [`tokenization`] | Educational content NFT minting and management |
@@ -107,6 +108,7 @@ mod notification;
107108mod notification_events_basic;
108109// mod notification_tests; // TODO: Re-enable when testutils dependencies are resolved
109110mod notification_types;
111+ mod reporting;
110112mod rewards;
111113mod slashing;
112114// mod social_events;
@@ -118,15 +120,17 @@ pub mod validation;
118120
119121pub use errors:: { BridgeError , EscrowError , RewardsError } ;
120122pub use types:: {
121- ArbitratorProfile , AtomicSwap , AuditRecord , BridgeMetrics , BridgeProposal , BridgeTransaction ,
122- ChainConfig , ChainMetrics , ComplianceReport , ConsensusState , ContentMetadata , ContentToken ,
123- ContentTokenParameters , CrossChainMessage , CrossChainPacket , DisputeOutcome , EmergencyState ,
124- Escrow , EscrowMetrics , EscrowParameters , EscrowStatus , LiquidityPool , MultiChainAsset ,
125- NotificationChannel , NotificationContent , NotificationPreference , NotificationSchedule ,
126- NotificationTemplate , NotificationTracking , OperationType , PacketStatus , ProposalStatus ,
127- ProvenanceRecord , RewardRate , RewardType , SlashingReason , SlashingRecord , SwapStatus ,
128- TransferType , UserNotificationSettings , UserReputation , UserReward , ValidatorInfo ,
129- ValidatorReward , ValidatorSignature ,
123+ AlertConditionType , AlertRule , ArbitratorProfile , AtomicSwap , AuditRecord , BridgeMetrics ,
124+ BridgeProposal , BridgeTransaction , ChainConfig , ChainMetrics , ComplianceReport , ConsensusState ,
125+ ContentMetadata , ContentToken , ContentTokenParameters , CrossChainMessage , CrossChainPacket ,
126+ DashboardAnalytics , DisputeOutcome , EmergencyState , Escrow , EscrowMetrics , EscrowParameters ,
127+ EscrowStatus , LiquidityPool , MultiChainAsset , NotificationChannel , NotificationContent ,
128+ NotificationPreference , NotificationSchedule , NotificationTemplate , NotificationTracking ,
129+ OperationType , PacketStatus , ProposalStatus , ProvenanceRecord , ReportComment , ReportSchedule ,
130+ ReportSnapshot , ReportTemplate , ReportType , ReportUsage , RewardRate , RewardType ,
131+ SlashingReason , SlashingRecord , SwapStatus , TransferType , UserNotificationSettings ,
132+ UserReputation , UserReward , ValidatorInfo , ValidatorReward , ValidatorSignature ,
133+ VisualizationDataPoint ,
130134} ;
131135
132136/// TeachLink main contract.
@@ -688,6 +692,114 @@ impl TeachLinkBridge {
688692 analytics::AnalyticsManager::get_bridge_statistics(&env)
689693 }
690694
695+ // ========== Advanced Analytics & Reporting Functions ==========
696+
697+ /// Get dashboard-ready aggregate analytics for visualizations
698+ pub fn get_dashboard_analytics(env: Env) -> DashboardAnalytics {
699+ reporting::ReportingManager::get_dashboard_analytics(&env)
700+ }
701+
702+ /// Create a report template
703+ pub fn create_report_template(
704+ env: Env,
705+ creator: Address,
706+ name: Bytes,
707+ report_type: ReportType,
708+ config: Bytes,
709+ ) -> Result<u64, BridgeError> {
710+ reporting::ReportingManager::create_report_template(&env, creator, name, report_type, config)
711+ }
712+
713+ /// Get report template by id
714+ pub fn get_report_template(env: Env, template_id: u64) -> Option<ReportTemplate> {
715+ reporting::ReportingManager::get_report_template(&env, template_id)
716+ }
717+
718+ /// Schedule a report
719+ pub fn schedule_report(
720+ env: Env,
721+ owner: Address,
722+ template_id: u64,
723+ next_run_at: u64,
724+ interval_seconds: u64,
725+ ) -> Result<u64, BridgeError> {
726+ reporting::ReportingManager::schedule_report(&env, owner, template_id, next_run_at, interval_seconds)
727+ }
728+
729+ /// Get scheduled reports for an owner
730+ pub fn get_scheduled_reports(env: Env, owner: Address) -> Vec<ReportSchedule> {
731+ reporting::ReportingManager::get_scheduled_reports(&env, owner)
732+ }
733+
734+ /// Generate a report snapshot
735+ pub fn generate_report_snapshot(
736+ env: Env,
737+ generator: Address,
738+ template_id: u64,
739+ period_start: u64,
740+ period_end: u64,
741+ ) -> Result<u64, BridgeError> {
742+ reporting::ReportingManager::generate_report_snapshot(
743+ &env, generator, template_id, period_start, period_end,
744+ )
745+ }
746+
747+ /// Get report snapshot by id
748+ pub fn get_report_snapshot(env: Env, report_id: u64) -> Option<ReportSnapshot> {
749+ reporting::ReportingManager::get_report_snapshot(&env, report_id)
750+ }
751+
752+ /// Record report view for usage analytics
753+ pub fn record_report_view(env: Env, report_id: u64, viewer: Address) -> Result<(), BridgeError> {
754+ reporting::ReportingManager::record_report_view(&env, report_id, viewer)
755+ }
756+
757+ /// Get report usage count
758+ pub fn get_report_usage_count(env: Env, report_id: u64) -> u32 {
759+ reporting::ReportingManager::get_report_usage_count(&env, report_id)
760+ }
761+
762+ /// Add comment to a report
763+ pub fn add_report_comment(
764+ env: Env,
765+ report_id: u64,
766+ author: Address,
767+ body: Bytes,
768+ ) -> Result<u64, BridgeError> {
769+ reporting::ReportingManager::add_report_comment(&env, report_id, author, body)
770+ }
771+
772+ /// Get comments for a report
773+ pub fn get_report_comments(env: Env, report_id: u64) -> Vec<ReportComment> {
774+ reporting::ReportingManager::get_report_comments(&env, report_id)
775+ }
776+
777+ /// Create an alert rule
778+ pub fn create_alert_rule(
779+ env: Env,
780+ owner: Address,
781+ name: Bytes,
782+ condition_type: AlertConditionType,
783+ threshold: i128,
784+ ) -> Result<u64, BridgeError> {
785+ reporting::ReportingManager::create_alert_rule(&env, owner, name, condition_type, threshold)
786+ }
787+
788+ /// Get alert rules for an owner
789+ pub fn get_alert_rules(env: Env, owner: Address) -> Vec<AlertRule> {
790+ reporting::ReportingManager::get_alert_rules(&env, owner)
791+ }
792+
793+ /// Evaluate alert rules (returns triggered rule ids)
794+ pub fn evaluate_alerts(env: Env) -> Vec<u64> {
795+ reporting::ReportingManager::evaluate_alerts(&env)
796+ }
797+
798+ /// Get recent report snapshots
799+ pub fn get_recent_report_snapshots(env: Env, limit: u32) -> Vec<ReportSnapshot> {
800+ reporting::ReportingManager::get_recent_report_snapshots(&env, limit)
801+ }
802+
691803 // ========== Rewards Functions ==========
692804
693805 /// Initialize the rewards system
0 commit comments