[package]
name         = "energy-api"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
description  = "Rust client and server implementation for German energy market API-Webdienste (MaKo)"
keywords     = ["edifact", "edi-energy", "bdew", "api", "ims"]
categories   = ["encoding"]

# ── Feature flags ────────────────────────────────────────────────────────────
#
#  client    — HTTP client for all APIs (reqwest + rustls)
#  server    — Axum-based server router factories
#  websocket — WebSocket subscription client (tokio-tungstenite)
#  crypto    — JWS ECDSA-SHA256 sign/verify for directory entries (p256)
#
[features]
default   = []
client    = ["dep:reqwest"]
server    = ["dep:axum", "dep:tower", "dep:http"]
websocket = ["dep:tokio-tungstenite", "dep:futures-util", "dep:tokio"]
crypto    = ["dep:p256", "dep:sha2", "dep:base64ct", "dep:serde_jcs"]

[dependencies]
serde      = { version = "1", features = ["derive"] }
serde_json = { workspace = true }
thiserror  = { workspace = true }
time       = { workspace = true, features = ["serde", "formatting", "parsing"] }
uuid       = { version = "1", features = ["v4", "serde"] }
url        = { version = "2", features = ["serde"] }

# ── client feature ───────────────────────────────────────────────────────────
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false, optional = true }

# ── server feature ───────────────────────────────────────────────────────────
axum  = { version = "0.8", optional = true }
tower = { version = "0.5", features = ["util"], optional = true }
http  = { version = "1", optional = true }

# ── websocket feature ────────────────────────────────────────────────────────
tokio-tungstenite = { version = "0.24", features = ["rustls-tls-webpki-roots"], optional = true }
futures-util      = { version = "0.3", optional = true }
tokio             = { version = "1", features = ["rt", "sync"], optional = true }

# ── crypto feature ───────────────────────────────────────────────────────────
p256      = { version = "0.13", features = ["ecdsa", "pem"], optional = true }
sha2      = { version = "0.10", optional = true }
base64ct  = { version = "1", features = ["alloc"], optional = true }
serde_jcs = { version = "0.1", optional = true }

[dev-dependencies]
serde_json = { workspace = true }
tokio      = { version = "1", features = ["full"] }
