[package]
name = "control-center"
version.workspace = true
edition.workspace = true
authors.workspace = true
description = "Control center service with JWT authentication, user management, and real-time WebSocket events"

[dependencies]
# ============================================================================
# WORKSPACE DEPENDENCIES
# ============================================================================

# Core async runtime
tokio = { workspace = true }
futures = { workspace = true }
async-trait = { workspace = true }

# Web server and API
axum = { workspace = true }
tower = { workspace = true }
tower-http = { workspace = true }
hyper = { workspace = true }

# Serialization and data
serde = { workspace = true }
serde_json = { workspace = true }
toml = { workspace = true }
uuid = { workspace = true }
chrono = { workspace = true }

# Database
surrealdb = { workspace = true }
sqlx = { workspace = true }

# Configuration and CLI
clap = { workspace = true }
config = { workspace = true }

# Error handling
thiserror = { workspace = true }
anyhow = { workspace = true }

# Logging
tracing = { workspace = true }
tracing-subscriber = { workspace = true }

# Validation
validator = { workspace = true }
regex = { workspace = true }

# HTTP client for external services
reqwest = { workspace = true }

# HTTP service clients (machines, init, AI) - enables remote service calls
service-clients = { path = "../service-clients" }

# Platform configuration management
platform-config = { path = "../platform-config" }

# Security and cryptography
ring = { workspace = true }
jsonwebtoken = { workspace = true }
argon2 = { workspace = true }
base64 = { workspace = true }
rand = { workspace = true }
aes-gcm = { workspace = true }
sha2 = { workspace = true }
hmac = { workspace = true }
getrandom = { workspace = true }

# ============================================================================
# ADDITIONAL WORKSPACE DEPENDENCIES
# ============================================================================

# System utilities
dirs = { workspace = true }

# Security and cryptography
rsa = { workspace = true }
hkdf = { workspace = true }
zeroize = { workspace = true }
constant_time_eq = { workspace = true }
subtle = { workspace = true }

# Tower services
tower-service = { workspace = true }
tower_governor = { workspace = true }

# Cedar policy engine
cedar-policy = { workspace = true }

# Template engine
tera = { workspace = true }

# Statistics
statistics = { workspace = true }

# Caching and storage
redis = { workspace = true }

# Scheduling
cron = { workspace = true }
tokio-cron-scheduler = { workspace = true }

# MFA Authentication
totp-rs = { workspace = true }
webauthn-rs = { workspace = true }
webauthn-rs-proto = { workspace = true }
qrcode = { workspace = true }
image = { workspace = true }
hex = { workspace = true }
lazy_static = { workspace = true }

[dev-dependencies]
tokio-test = { workspace = true }
tempfile = { workspace = true }
assert_matches = { workspace = true }

# ============================================================================
# FEATURES - Module Organization for Coupling Reduction
# ============================================================================
#
# Rationale: Feature flags organize 46+ modules into logical groups,
# reducing visible module count from 46 to ~12 core modules.
# This enables:
# - Selective compilation (faster builds for minimal setups)
# - Dependency reduction (unused features don't get linked)
# - Clear module responsibilities (features map to functionality)
# - Dead code elimination at compile time
#
[features]
# Core: Always-on, required for basic functionality
# Modules: auth, handlers, services, storage, models, middleware, clients
core = []

# KMS: Key Management System - Encryption/decryption operations
# Modules: kms, storage enhancements
kms = ["core"]

# Audit: Security event logging and compliance audit trails
# Modules: audit
audit = ["core"]

# MFA: Multi-factor authentication (TOTP, WebAuthn)
# Modules: mfa
mfa = ["core"]

# Compliance: Policy evaluation and compliance checking (experimental)
# Modules: compliance, policies
compliance = ["core"]

# Experimental: Advanced features in development
# Modules: anomaly (detection)
experimental = ["core"]

# Default: Recommended for standard deployments
# Includes auth, KMS, audit - the essentials
default = ["core", "kms", "audit"]

# Full: All features enabled (development and testing)
all = ["core", "kms", "audit", "mfa", "compliance", "experimental"]

# Library target
[lib]
name = "control_center"
path = "src/lib.rs"

# Binary target (uses all features)
[[bin]]
name = "control-center"
path = "src/main.rs"
required-features = ["all"]