/* Bio-Digital opcode and operand contracts. */
#ifndef BIO_OPCODE_H_
#define BIO_OPCODE_H_

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#define BIO_MAX_OPERANDS 16u
#define BIO_MAX_KEY_BYTES 32u
#define BIO_MAX_VALUE_BYTES 256u

typedef enum bio_opcode {
    BIO_OPCODE_ABSORB_GGUF = 0,
    BIO_OPCODE_MANIFOLD_ADDR,
    BIO_OPCODE_PULSE,
    BIO_OPCODE_PRUNE,
    BIO_OPCODE_ZPM_SKIP,
    BIO_OPCODE_OMEGA_ROUTE,
    BIO_OPCODE_LEARN_CYCLE,
    BIO_OPCODE_INFER_CHAT,
    BIO_OPCODE_DELTA_COMMIT,
    BIO_OPCODE_CACHE_BIND,
    BIO_OPCODE_SYNC_FENCE,
    BIO_OPCODE_HALT,
    BIO_OPCODE_COUNT
} bio_opcode;

typedef struct bio_operand_pair {
    char key[BIO_MAX_KEY_BYTES];
    char value[BIO_MAX_VALUE_BYTES];
} bio_operand_pair;

typedef struct bio_operands {
    uint32_t line;
    uint32_t count;
    bio_operand_pair pairs[BIO_MAX_OPERANDS];
} bio_operands;

const char *bio_opcode_name(bio_opcode opcode);
int bio_opcode_from_token(const char *token, bio_opcode *opcode_out);

#ifdef __cplusplus
}
#endif

#endif /* BIO_OPCODE_H_ */
