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
//! # Services Module
//!
//! Business logic and service layer for the Quetty terminal user interface.
//! This module provides high-level services that encapsulate complex operations
//! and coordinate between different parts of the application.
//!
//! ## Architecture
//!
//! The services layer acts as an intermediary between UI components and the core
//! server functionality, providing:
//!
//! - **Abstraction** - Simplified interfaces for complex operations
//! - **State Management** - Coordinated state between UI and business logic
//! - **Error Handling** - Consistent error handling and user feedback
//! - **Async Coordination** - Proper async operation management
//!
//! ## Available Services
//!
//! ### Authentication Service
//!
//! The [`AuthService`] provides high-level authentication operations:
//!
//! ```ignore
//! use quetty::services::AuthService;
//!
//! let auth_service = AuthService::new();
//!
//! // Handle authentication flow
//! match auth_service.authenticate_user(&config).await {
//! Ok(token) => println!("Authentication successful"),
//! Err(e) => eprintln!("Authentication failed: {}", e),
//! }
//! ```
//!
//! ### Shared Authentication State
//!
//! Global authentication state management for the UI:
//!
//! ```ignore
//! use quetty::services::init_shared_auth_state;
//!
//! // Initialize shared authentication state
//! let auth_state = init_shared_auth_state();
//!
//! // Use across the application
//! if auth_state.is_authenticated().await {
//! // Proceed with authenticated operations
//! }
//! ```
//!
//! ## Integration with Components
//!
//! Services are designed to be easily integrated with UI components:
//!
//! - **Stateless Operations** - Services can be called from any component
//! - **Consistent APIs** - Uniform interfaces across all services
//! - **Error Propagation** - Structured error handling for UI feedback
//! - **Async Support** - Full async/await support for non-blocking UI
pub use AuthService;
pub use init_shared_auth_state;