//! Transport adapters for iddrop.
//!
//! The protocol-engine is transport-agnostic. Two adapter families:
//!
//! - [`proximity`] — NFC, QR, BLE, local discovery. Geared for
//!   offer-first mode. v0.1 ships only a placeholder stub.
//! - [`wire`] — i-poll, HTTP, cap-bus. Geared for request-first
//!   mode. v0.1 ships an HTTP stub against
//!   `https://brein.jaspervandemeent.nl`.

use crate::errors::Result;

pub mod proximity;
#[cfg(feature = "wire")]
pub mod wire;

/// Common interface every transport adapter implements.
pub trait Transport {
    /// Human-readable transport identifier (e.g. `"http"`, `"nfc"`).
    fn name(&self) -> &'static str;

    /// Send a serialised iddrop object (Offer / Request / sealed claim).
    fn send(&self, peer: &str, bytes: &[u8]) -> Result<()>;

    /// Receive the next serialised iddrop object, if any.
    /// `peer` filter is optional — empty string = any peer.
    fn recv(&self, peer: &str) -> Result<Option<Vec<u8>>>;
}
