// seq_validator.h — ordered-scan validator (QR P3). Pure logic, no I/O.
#pragma once
#include <stdbool.h>
#include <stddef.h>

#define SEQ_MAX_STEPS 16
#define SEQ_MAX_LABEL 32

typedef struct {
    char     expected[SEQ_MAX_STEPS][SEQ_MAX_LABEL];
    size_t   count;
    size_t   pos;     // next index to match
} seq_validator_t;

// expected: array of `count` C-strings (<= SEQ_MAX_STEPS, each < SEQ_MAX_LABEL).
// All expected labels must be distinct: duplicates make the sequence uncompletable.
// v and expected must be non-NULL; no internal NULL checks are performed.
void seq_validator_init(seq_validator_t *v, const char *const *expected, size_t count);

// Feed one scanned code. Returns true exactly when the full sequence is done.
// A wrong code resets progress; a duplicate of the last matched code is ignored.
bool seq_validator_feed(seq_validator_t *v, const char *code);
