[package]
name = "scirs2-io"
version.workspace = true
edition.workspace = true
authors.workspace = true
description = "Input/Output utilities module for SciRS2 (scirs2-io)"
readme = "README.md"
license.workspace = true
repository.workspace = true
keywords = ["io", "serialization", "data", "scientific", "scipy"]
categories = ["science", "encoding"]

[lints]
workspace = true
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]


[dependencies]
# Core dependencies - ALL numeric/array/random functionality from scirs2-core (SciRS2 POLICY)
scirs2-core = { workspace = true, features = ["parallel", "simd", "gpu", "array", "random"] }
byteorder = { workspace = true }
image = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
oxicode = { workspace = true }  # Binary serialization (SIMD-optimized)
rmp-serde = { workspace = true }
oxiarc-archive = { workspace = true }  # Pure Rust compression (COOLJAPAN Policy)
# C-backed compression libraries (feature-gated for backward compatibility)
flate2 = { workspace = true, optional = true }
lz4 = { workspace = true, optional = true }
zstd = { workspace = true, optional = true }
bzip2 = { workspace = true, optional = true }
sha2 = { workspace = true }
crc32fast = { workspace = true }
blake3 = { workspace = true }
hex = { workspace = true }
digest = { workspace = true }
data-encoding = { workspace = true }
chrono = { workspace = true }
tempfile = { workspace = true }
regex = { workspace = true }
glob = { workspace = true }
netcdf3 = { workspace = true }
kamadak-exif = { workspace = true }
hdf5 = { workspace = true, optional = true }
# rayon = { workspace = true }  # Now use scirs2-core parallel abstractions
thiserror = { workspace = true }
tokio = { workspace = true, optional = true, features = ["fs", "io-util", "time", "rt"] }
futures = { workspace = true, optional = true }
futures-util = { workspace = true, optional = true }
log = { workspace = true, optional = true }
async-trait = { workspace = true, optional = true }
memmap2 = { workspace = true }
bytemuck = { workspace = true }
reqwest = { workspace = true, optional = true }
num_cpus = { workspace = true }
statrs = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
# Apache Arrow and Parquet support
arrow = { workspace = true, optional = true }
arrow-array = { workspace = true, optional = true }
arrow-schema = { workspace = true, optional = true }
arrow-cast = { workspace = true, optional = true }
parquet = { workspace = true, optional = true }
serde_yaml = { workspace = true }
toml = { workspace = true }
uuid = { workspace = true, features = ["v4", "serde"] }
urlencoding = { workspace = true }
crossbeam-channel = { workspace = true }
cron = { workspace = true }
miniz_oxide = { workspace = true }  # Pure Rust DEFLATE (for MATLAB compression)
snap = { workspace = true }  # Pure Rust Snappy
brotli = { workspace = true }  # Pure Rust Brotli (Dropbox implementation)
# Database drivers
rusqlite = { workspace = true, optional = true }
# sqlx removed - postgres/mysql implementations are stubs only
mongodb = { workspace = true, optional = true }
redis = { workspace = true, optional = true }
# Real-time streaming
tokio-tungstenite = { workspace = true, optional = true }
rumqttc = { workspace = true, optional = true }
eventsource-client = { workspace = true, optional = true }
tonic = { workspace = true, optional = true }
prost = { workspace = true, optional = true }
url = { workspace = true }

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

[features]
default = ["csv", "compression", "validation"]
csv = []
# Default compression uses 100% Pure Rust libraries (COOLJAPAN Policy)
compression = []
# Legacy C-backed compression (feature-gated, not in default)
compression-c = ["dep:flate2", "dep:lz4", "dep:zstd", "dep:bzip2"]
validation = []
hdf5 = ["dep:hdf5"]
parquet = ["dep:parquet", "dep:arrow", "dep:arrow-array", "dep:arrow-schema", "dep:arrow-cast"]
async = ["dep:tokio", "dep:futures", "dep:futures-util", "dep:async-trait"]
reqwest = ["dep:reqwest", "dep:log"]
aws-sdk-s3 = []
google-cloud-storage = []
azure-storage-blobs = []
# GPU compression currently requires C-backed libraries for block-level APIs
# TODO: Migrate to Pure Rust when oxiarc-archive adds block compression support
gpu = ["compression-c"]
exif = []
# Database features
sqlite = ["dep:rusqlite"]
postgres = ["async"]  # Stub implementation only (no actual sqlx dependency)
mysql = ["async"]     # Stub implementation only (no actual sqlx dependency)
mongodb = ["dep:mongodb", "async"]
redis = ["dep:redis"]
database = ["sqlite", "postgres", "mysql"]
database-full = ["database"]  # Full database support
# Real-time streaming features
websocket = ["dep:tokio-tungstenite", "async"]
mqtt = ["dep:rumqttc", "async"]
sse = ["dep:eventsource-client", "async", "reqwest"]
grpc = ["dep:tonic", "dep:prost", "async"]
realtime = ["websocket", "mqtt", "sse", "grpc"]
all = ["csv", "compression", "validation", "hdf5", "async", "reqwest", "aws-sdk-s3", "google-cloud-storage", "azure-storage-blobs", "gpu", "exif", "database", "mongodb", "redis", "realtime"]

[[example]]
name = "hdf5_example"
path = "examples/hdf5_example.rs"
required-features = ["hdf5"]

[[example]]
name = "async_io_example"
path = "examples/async_io_example.rs"
required-features = ["async"]

[[example]]
name = "network_cloud_example"
path = "examples/network_cloud_example.rs"
required-features = ["async", "reqwest"]
