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
//! Accounting management plugin for budget and settlement
//!
//! This plugin provides:
//! - `Currency`: Safe currency type with saturation arithmetic
//! - `BudgetLedger`: Resource tracking multiple financial pools
//! - `AccountingService`: Service for pure financial calculations
//! - `AccountingSystem`: System for periodic settlement orchestration
//! - `AccountingPlugin`: Plugin for registering accounting components
//!
//! # Architecture
//!
//! The accounting plugin follows a settlement-based design:
//! - **Event-driven**: Reacts to settlement requests and time events
//! - **Configurable**: Settlement period and calculation logic customizable via hooks
//! - **Composable**: Service/System separation allows flexible reuse
//!
//! # Usage Example
//!
//! ```ignore
//! use issun::builder::GameBuilder;
//! use issun::plugin::accounting::{AccountingPlugin, AccountingConfig, Currency};
//! use issun::plugin::time::TimePlugin;
//! use issun::context::ResourceContext;
//!
//! // Register the plugins
//! let game = GameBuilder::new()
//! .with_plugin(TimePlugin::default())?
//! .with_plugin(AccountingPlugin::new()
//! .with_hook(MyAccountingHook)
//! )?
//! .build()
//! .await?;
//!
//! // In your game loop
//! async fn game_loop(resources: &mut ResourceContext) {
//! // Access budget ledger
//! let mut ledger = resources.get_mut::<BudgetLedger>().await.unwrap();
//! ledger.cash = ledger.cash.saturating_add(Currency::new(500));
//! drop(ledger);
//!
//! // Accounting system will automatically run settlements when requested
//! }
//! ```
pub use AccountingConfig;
pub use *;
pub use ;
pub use AccountingPlugin;
pub use ;
pub use AccountingService;
pub use AccountingState;
pub use AccountingSystem;
pub use Currency;