#ifndef XANADOC_TYPES_H
#define XANADOC_TYPES_H

#include "../dtob/lib/dtob_types.h"

/*
 * Xanadoc custom DTOB type codes.
 *
 * Canonical definition — included by both:
 *   - xanadex-obsidian/src/xanadoc_wasm.c  (compiled to WASM)
 *   - sculblog/src/sculblog_ffi.c          (linked as native .a)
 */

#define XANADOC_CCID         (DTOB_CUSTOM_MIN + 0)  /* 16 - raw */
#define XANADOC_CID          (DTOB_CUSTOM_MIN + 1)  /* 17 - raw */
#define XANADOC_SHA256CID    (DTOB_CUSTOM_MIN + 2)  /* 18 - raw */
#define XANADOC_IDS          (DTOB_CUSTOM_MIN + 3)  /* 19 - struct(ccid, cid, sha256cid) */
#define XANADOC_POTC         (DTOB_CUSTOM_MIN + 4)  /* 20 - raw */
#define XANADOC_LENGTH       (DTOB_CUSTOM_MIN + 5)  /* 21 - enum(uint8|uint16|uint32|uint64) */
#define XANADOC_DEF_START    (DTOB_CUSTOM_MIN + 6)  /* 22 - enum(uint8|uint16|uint32|uint64) */
#define XANADOC_REF_START    (DTOB_CUSTOM_MIN + 7)  /* 23 - enum(uint8|uint16|uint32|uint64) */
#define XANADOC_TRANSCLUSION (DTOB_CUSTOM_MIN + 8)  /* 24 - struct(potc, length, def_start, ref_start) */
#define XANADOC_MICROLINK    (DTOB_CUSTOM_MIN + 9)  /* 25 - struct(ids, length, def_start, ccid, length, ref_start) */
#define XANADOC_MACROLINK    (DTOB_CUSTOM_MIN + 10) /* 26 - struct(ids, ccid, length, ref_start) */

DTOB_DEFINE_CUSTOM_TYPES(xanadoc, th,
    DTOB_CUSTOM_TYPE_RAW    (th, XANADOC_CCID,        "ccid")
    DTOB_CUSTOM_TYPE_RAW    (th, XANADOC_CID,         "cid")
    DTOB_CUSTOM_TYPE_RAW    (th, XANADOC_SHA256CID,   "sha256cid")
    DTOB_CUSTOM_TYPE_STRUCT (th, XANADOC_IDS,         "ids",          XANADOC_CCID, XANADOC_CID, XANADOC_SHA256CID)
    DTOB_CUSTOM_TYPE_RAW    (th, XANADOC_POTC,        "potc")
    DTOB_CUSTOM_TYPE_ENUM   (th, XANADOC_LENGTH,      "length",       DTOB_CODE_UINT8, DTOB_CODE_UINT16, DTOB_CODE_UINT32, DTOB_CODE_UINT64)
    DTOB_CUSTOM_TYPE_ENUM   (th, XANADOC_DEF_START,   "def_start",    DTOB_CODE_UINT8, DTOB_CODE_UINT16, DTOB_CODE_UINT32, DTOB_CODE_UINT64)
    DTOB_CUSTOM_TYPE_ENUM   (th, XANADOC_REF_START,   "ref_start",    DTOB_CODE_UINT8, DTOB_CODE_UINT16, DTOB_CODE_UINT32, DTOB_CODE_UINT64)
    DTOB_CUSTOM_TYPE_STRUCT (th, XANADOC_TRANSCLUSION,"transclusion", XANADOC_POTC, XANADOC_LENGTH, XANADOC_DEF_START, XANADOC_REF_START)
    DTOB_CUSTOM_TYPE_STRUCT (th, XANADOC_MICROLINK,   "microlink",    XANADOC_IDS, XANADOC_LENGTH, XANADOC_DEF_START, XANADOC_IDS, XANADOC_LENGTH, XANADOC_REF_START)
    DTOB_CUSTOM_TYPE_STRUCT (th, XANADOC_MACROLINK,   "macrolink",    XANADOC_IDS, XANADOC_IDS, XANADOC_LENGTH, XANADOC_REF_START)
)

#endif /* XANADOC_TYPES_H */
