//! Typed wire contracts
//!
//! `wire` contains protocol values that cross service boundaries. Primitive
//! values stay in `efdn::types`; this crate composes them into RPC, NATS, and
//! HTTP contracts.

//! ## Features
//!
//! ## Messages
//!
//! `#[efdn::wire::message]` derives rkyv serialization, wire validation, and
//! a schema ID. Message names must end with `Req`, `Rep`, `Frame`, `InFrame`,
//! `OutFrame`, or `Evt`. Fields must be typed newtypes.
//!
//! ```text
//! #[efdn::wire::message]
//! pub struct ExecReq { ... }
//! ```
//!
//! `to_bytes` encodes declared payloads and `Result<Rep, E>` handler results.
//! `from_bytes::<T>` decodes declared payloads and unwraps successful reply
//! envelopes for `Rep` messages.
//!
//! Compression uses LZ4. Encoding accepts [`Compression::Off`],
//! [`Compression::Auto`], or [`Compression::On`]. [`WireLimits`] controls body
//! bytes, raw bytes, expansion ratio, and minimum saved bytes.
//!
//! ## Catalogs
//!
//! Catalog macros derive `Clone` and `Debug`, add `new`, and turn each field
//! into a typed method. Each catalog has exactly one `#[version]` field.
//! Operation payloads follow the same stem:
//!
//! | Mode | Payloads |
//! | --- | --- |
//! | `Unary` | `ShellExecReq`, `ShellExecRep` |
//! | `ServerStream` | `ShellExecReq`, `ShellExecFrame` |
//! | `ClientStream` | `ShellExecFrame`, `ShellExecRep` |
//! | `BidiStream` | `ShellExecInFrame`, `ShellExecOutFrame` |
//! | `Event` | `ShellExecEvt` |
//!
//! ```text
//! namespace.surface.version.scope_kind.scope_value.domain.action.arg_kind.arg_value
//! ```
//!
//! NATS stream subjects are generated from the base subject:
//!
//! ```text
//! base.call.call_id.out
//! base.call.call_id.out.flow
//! base.call.call_id.in
//! base.call.call_id.in.flow
//! ```
//!
//! HTTP catalogs live under `efdn::wire::http::catalog`. NATS catalogs live
//! under `efdn::wire::nats::catalog`.

mod compression;
mod frame;
mod limits;
pub mod message;
pub mod rpc;
mod validate;

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

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

pub use message::{
    Compression, CompressionRatio, MessageKind, MessageName, MessageSchema, WireCodec,
    WireCodecError, WireDecode, WireEncode, WireFrame, WireLimits, WirePayload, WireValidate,
    from_bytes, to_bytes,
};
