//! Receipt returned by `Substrate::apply`.

use ontoref_blobs::BlobId;
use ontoref_commit::{StateRoot, Witness};
use ontoref_types::OpId;
use serde::{Deserialize, Serialize};

/// Pipeline output for one applied operation.
///
/// Field declaration order follows lex sort so canonical CBOR emission stays
/// stable across versions (`blob_id` < `op_id` < `state_root` < `witnesses`).
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Receipt {
    /// Content address of the canonical-encoded operation in the blob store.
    pub blob_id: BlobId,
    /// Content address of the operation as stored in the op log.
    pub op_id: OpId,
    /// Commit-layer state root after applying this operation.
    pub state_root: StateRoot,
    /// One Merkle inclusion proof per `(entity, attr)` cell touched. Empty
    /// for `Noop` operations.
    pub witnesses: Vec<Witness>,
}
