syntax = "proto3";
package note;

import "account.proto";
import "block.proto";
import "digest.proto";
import "merkle.proto";

// Represents a note's metadata.
message NoteMetadata {
    // The account which sent the note.
    account.AccountId sender = 1;

    // The type of the note (0b01 = public, 0b10 = private, 0b11 = encrypted).
    uint32 note_type = 2;

    // A value which can be used by the recipient(s) to identify notes intended for them.
    //
    // See `miden_objects::note::note_tag` for more info.
    fixed32 tag = 3;

    // Specifies when a note is ready to be consumed.
    //
    // See `miden_objects::note::execution_hint` for more info.
    fixed64 execution_hint = 4;

    // An arbitrary user-defined value.
    fixed64 aux = 5;
}

// Represents a note.
message Note {
    // The block number in which the note was created.
    fixed32 block_num = 1;

    // The index of the note in the block.
    uint32 note_index = 2;

    // The ID of the note.
    digest.Digest note_id = 3;

    // The note's metadata.
    NoteMetadata metadata = 4;

    // The note's inclusion proof in the block.
    merkle.MerklePath merkle_path = 5;

    // Serialized details of the public note (empty for private notes).
    optional bytes details = 6;
}

// Represents a proof of note's inclusion in a block.
//
// Does not include proof of the block's inclusion in the chain.
message NoteInclusionInBlockProof {
    // A unique identifier of the note which is a 32-byte commitment to the underlying note data.
    digest.Digest note_id = 1;

    // The block number in which the note was created.
    fixed32 block_num = 2;

    // The index of the note in the block.
    uint32 note_index_in_block = 3;

    // The note's inclusion proof in the block.
    merkle.MerklePath merkle_path = 4;
}

// Represents proof of a note inclusion in the block.
message NoteSyncRecord {
    // The index of the note.
    uint32 note_index = 1;

    // A unique identifier of the note which is a 32-byte commitment to the underlying note data.
    digest.Digest note_id = 2;

    // The note's metadata.
    NoteMetadata metadata = 3;

    // The note's inclusion proof in the block.
    merkle.MerklePath merkle_path = 4;
}
