//! DTOB wire constants — keep in sync with `vendor/dtob/lib/dtob.h` and `lexer.c`.
//! The scanner in `serve` follows the same rules as `lexer_next` (blast skip, ctrl layout, custom range).

pub const DTOB_MAGIC: &[u8; 8] = b"13032026";

pub const DTOB_CTRL_MASK: u8 = 0xC0;
pub const DTOB_CODE_MASK: u8 = 0x1F;

pub const DTOB_CODE_OPEN: u16 = 0;
pub const DTOB_CODE_ARR_CLOSE: u16 = 1;
pub const DTOB_CODE_KV_CLOSE: u16 = 2;
pub const DTOB_CODE_TYPES_CLOSE: u16 = 3;
pub const DTOB_CODE_UQT: u16 = 4; // unimplemented; reserved
pub const DTOB_CODE_RAW: u16 = 5;
pub const DTOB_CODE_FLOAT: u16 = 6;
pub const DTOB_CODE_DOUBLE: u16 = 7;
pub const DTOB_CODE_INT8: u16 = 8;
pub const DTOB_CODE_INT16: u16 = 9;
pub const DTOB_CODE_INT32: u16 = 10;
pub const DTOB_CODE_INT64: u16 = 11;
pub const DTOB_CODE_UINT8: u16 = 12;
pub const DTOB_CODE_UINT16: u16 = 13;
pub const DTOB_CODE_UINT32: u16 = 14;
pub const DTOB_CODE_UINT64: u16 = 15;
pub const DTOB_CODE_BLAST: u16 = 8191;

pub const DTOB_CUSTOM_MIN: u16 = 16;
pub const DTOB_CUSTOM_MAX: u16 = 8190;

/// Sculblog DIF custom opcodes (`src/sculblog_ffi.c` — must match `DTOB_CUSTOM_MIN + n`).
pub const DIF_CCID: u16 = 16;
pub const DIF_OP: u16 = 17;
pub const DIF_COPY: u16 = 18;
pub const DIF_ADD: u16 = 19;
pub const DIF_START: u16 = 20;
pub const DIF_END: u16 = 21;
pub const DIF_DATA: u16 = 22;
