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
//! # lab-resource-manager
//!
//! GPU and room resource management system with Google Calendar and Slack integration.
//!
//! This crate provides a resource management system designed for research labs,
//! tracking GPU servers and meeting room reservations through Google Calendar
//! and sending notifications via Slack.
//!
//! ## Architecture
//!
//! Built with Clean Architecture (DDD + Hexagonal Architecture):
//!
//! - **Domain Layer**: Core business logic, aggregates, and value objects
//! - **Application Layer**: Use cases that orchestrate domain logic
//! - **Infrastructure Layer**: External system integrations (Google Calendar, Slack)
//!
//! ## Usage as a Binary
//!
//! The primary use case is running the watcher service:
//!
//! ```bash
//! # Run with Google Calendar and Slack
//! cargo run --bin watcher
//!
//! # Run with mock implementations for testing
//! cargo run --bin watcher --notifier mock --repository mock
//!
//! # Customize polling interval (default: 60 seconds)
//! cargo run --bin watcher --interval 30
//! ```
//!
//! ## Usage as a Library
//!
//! You can also use this crate as a library to build custom resource management systems:
//!
//! ```rust,no_run
//! use lab_resource_manager::{
//! NotifyFutureResourceUsageChangesUseCase,
//! GoogleCalendarUsageRepository,
//! NotificationRouter,
//! JsonFileIdentityLinkRepository,
//! load_config,
//! };
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Load configuration
//! let config = load_config("config/resources.toml")?;
//!
//! // Create repository and notifier
//! let repository = Arc::new(
//! GoogleCalendarUsageRepository::new(
//! "secrets/service-account.json",
//! config.clone(),
//! "data/google_calendar_mappings.json".into(),
//! )
//! .await?,
//! );
//! // Create identity link repository for Slack user mapping
//! let identity_repo = Arc::new(JsonFileIdentityLinkRepository::new("data/identity_links.json".into()));
//! // NotificationRouter automatically supports all configured notification types
//! // (Slack, Mock, etc.) based on config/resources.toml
//! let notifier = NotificationRouter::new(config, identity_repo);
//!
//! // Create and run use case
//! let usecase = NotifyFutureResourceUsageChangesUseCase::new(repository, notifier).await?;
//! usecase.poll_once().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Device Specification Format
//!
//! Calendar event titles support flexible device specification:
//!
//! - Single: `0` → Device 0
//! - Range: `0-2` → Devices 0, 1, 2
//! - Multiple: `0,2,5` → Devices 0, 2, 5
//! - Mixed: `0-1,6-7` → Devices 0, 1, 6, 7
//!
//! ## Features
//!
//! - Google Calendar integration for resource reservations
//! - Slack notifications for create/update/delete events
//! - DDD Factory Pattern for device specification parsing
//! - Mock implementations for testing
//! - CLI arguments for flexible deployment
//!
//! ## Setup
//!
//! See the [README](https://github.com/kano-lab/lab-resource-manager) for detailed setup instructions.
// Module declarations
/// Commonly used types for building resource management systems
///
/// This prelude re-exports the most frequently used types and traits,
/// allowing users to import everything they need with a single use statement:
///
/// ```rust
/// use lab_resource_manager::prelude::*;
/// ```
// Convenience re-exports at crate root
pub use ;
pub use ;
pub use ;