#ifndef OBFUSCATE_FILE_H
#define OBFUSCATE_FILE_H

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

/* 32-bit dummy header/tail — skipped by decode; only uint64_t payloads are processed. */
#define OBF_FILE_HDR_SIZE  4u
#define OBF_FILE_TAIL_SIZE 4u
#define OBF_FILE_OVERHEAD  (OBF_FILE_HDR_SIZE + OBF_FILE_TAIL_SIZE)

#define OBF_ERR_IO        -4
#define OBF_ERR_FORMAT    -5
#define OBF_ERR_OVERFLOW  -6

int32_t write_to(const char *path, uint64_t val, uint64_t seed);
int32_t read_from(const char *path, uint64_t seed, uint64_t *out);

int32_t write_many_to(const char *path, const uint64_t *vals, size_t count, uint64_t seed);

int32_t read_many_from(const char *path, uint64_t seed, uint64_t *out_vals, size_t out_cap,
		       size_t *out_count);

/* How many uint64_t payloads are stored (excludes 32-bit head/tail). */
int32_t obf_file_payload_count(long file_size, size_t *count_out);

#endif /* OBFUSCATE_FILE_H */
