[package]
name = "provisioning-orchestrator"
version.workspace = true
edition.workspace = true
authors.workspace = true
description = "Cloud-native infrastructure orchestrator with Nushell integration"

[dependencies]
# ============================================================================
# WORKSPACE DEPENDENCIES - Core async runtime and traits
# ============================================================================
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "process", "io-util", "time", "fs"] }
futures = { workspace = true }
async-trait = { workspace = true }

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

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

# Logging framework (used throughout)
tracing = { workspace = true }

# Web server and API
axum = { workspace = true }
tower-http = { workspace = true, features = ["cors", "trace"] }

# CLI interface
clap = { workspace = true }

# Logging configuration (binary-only, but required for compilation)
tracing-subscriber = { workspace = true }

# Docker/Container management
bollard = "0.17"

# HTTP client for DNS/OCI/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" }

# LRU cache for OCI manifests
lru = "0.12"

# Authorization policy engine
cedar-policy = "4.2"

# File system watcher for hot reload
notify = "6.1"

# Base64 encoding/decoding
base64 = "0.22"

# JWT token validation
jsonwebtoken = { workspace = true }

# Cryptography for token validation
sha2 = { workspace = true }
rsa = { workspace = true }
rand = { workspace = true }
getrandom = { workspace = true }

# SSH key management
ed25519-dalek = "2.1"

# SSH client library (pure Rust, async-first)
russh = "0.44"
russh-keys = "0.44"

# Path expansion for tilde (~) handling
shellexpand = "3.1"

# ============================================================================
# FEATURE-GATED OPTIONAL DEPENDENCIES
# ============================================================================

# SurrealDB storage backend (optional)
surrealdb = { workspace = true, optional = true }

# ============================================================================
# FEATURES - Module Organization for Coupling Reduction
# ============================================================================
#
# Rationale: Feature flags organize 25+ modules into logical groups,
# reducing visible module count from 25 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: config, storage, state, services, middleware, security
core = []

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

# Compliance: Policy evaluation and compliance checking
# Modules: compliance, break_glass
compliance = ["core"]

# Platform: Infrastructure integration and management
# Modules: dns, extensions, oci
platform = ["core"]

# SSH: SSH key management and operations
# Modules: ssh
ssh = ["core"]

# Workflow: Batch jobs, workflow orchestration, and task management
# Modules: workflow, queue, rollback, migration, monitor, batch, dependency
workflow = ["core"]

# Testing: Test environment and container management
# Modules: container_manager, test_environment, test_orchestrator
testing = ["core"]

# HTTP API: REST API endpoints for external integration
http-api = ["core"]

# SurrealDB: Optional storage backend
surrealdb = ["dep:surrealdb"]

# Default: Recommended for standard deployments
# Includes core, audit, compliance, platform, ssh, workflow
default = ["core", "audit", "compliance", "platform", "ssh", "workflow", "http-api"]

# Full: All features enabled (development and testing)
all = ["core", "audit", "compliance", "platform", "ssh", "workflow", "testing", "http-api", "surrealdb"]

[dev-dependencies]
tokio-test = { workspace = true }
tempfile = { workspace = true }
assert_matches = { workspace = true }
criterion = { workspace = true, features = ["html_reports", "async_tokio"] }
tower = { workspace = true, features = ["util"] }

# Library target for tests and external use
[lib]
name = "provisioning_orchestrator"
path = "src/lib.rs"

# Binary target (requires testing feature for test environment API)
[[bin]]
name = "provisioning-orchestrator"
path = "src/main.rs"
required-features = ["all"]

[[bench]]
name = "storage_benchmarks"
harness = false

[[bench]]
name = "migration_benchmarks"
harness = false