//! Synor Storage Layer
//!
//! Decentralized storage network for the Synor blockchain ecosystem.
//! Enables permanent, censorship-resistant storage of any file type.
//!
//! # Architecture
//!
//! The storage layer operates as L2 alongside the Synor blockchain (L1):
//! - **Content Addressing**: Files identified by cryptographic hash (CID)
//! - **Erasure Coding**: Data split with redundancy for fault tolerance
//! - **Storage Proofs**: Nodes prove they're storing data to earn rewards
//! - **Gateways**: HTTP access for web browsers
//!
//! # Example
//!
//! ```rust,ignore
//! use synor_storage::{ContentId, Chunker, StorageClient};
//!
//! // Upload a file
//! let data = std::fs::read("myfile.zip")?;
//! let cid = ContentId::from_content(&data);
//! client.store(cid, &data).await?;
//!
//! // Retrieve by CID
//! let retrieved = client.retrieve(&cid).await?;
//! ```

pub mod cid;
pub mod chunker;
pub mod erasure;
pub mod proof;
pub mod deal;
pub mod error;

// Node module - storage node implementation
pub mod node;

// Gateway module - HTTP access to stored content
pub mod gateway;

pub use cid::ContentId;
pub use chunker::{Chunk, Chunker};
pub use error::{Error, Result};
pub use node::{NodeConfig, StorageNode, NodeState, NodeStats};
pub use gateway::{Gateway, GatewayConfig, GatewayStats};

/// Storage layer configuration
#[derive(Debug, Clone)]
pub struct StorageConfig {
    /// Chunk size in bytes (default: 1MB)
    pub chunk_size: usize,
    /// Number of data shards for erasure coding
    pub data_shards: usize,
    /// Number of parity shards for erasure coding
    pub parity_shards: usize,
    /// Replication factor (copies per shard)
    pub replication_factor: usize,
}

impl Default for StorageConfig {
    fn default() -> Self {
        Self {
            chunk_size: 1024 * 1024, // 1 MB
            data_shards: 10,
            parity_shards: 4,
            replication_factor: 3,
        }
    }
}
