#ifndef OPTIONS_H_INCLUDED
#define OPTIONS_H_INCLUDED

#include <stdio.h>
#include "hash.h"

// engine output: nothing, best move only, every new PV, real-time statistics
typedef enum {OM_NONE, OM_BASIC, OM_PV, OM_FULL} OUTPUTMODE;

// the options data type
typedef struct {
    FILE* log;
    int c960;
    OUTPUTMODE om;
} OPTIONS;

// set the options to their default values and initialise the hash table
void opt_init(OPTIONS* opt, HASHTABLE* ht);

// close the log file, deallocate the hash table
void opt_free(OPTIONS* opt, HASHTABLE* ht);

// log file name
#define LOG_FILE "log.txt"

// UCI option names
#define LOG_UCI_NAME "LogFile"
#define C960_UCI_NAME "UCI_Chess960"
#define OM_UCI_NAME "OutputMode"
extern const char* const om_uci_val[];
#define HT_UCI_NAME "Hash"

// input/output in UCI format
void opt_scan_uci(char* uci, OPTIONS* opt, HASHTABLE* ht);

// UCI option strings
#define PONDER_UCI_STR "option name Ponder type check default true"
#define LOG_UCI_STR "option name LogFile type check default false"
#define C960_UCI_STR "option name UCI_Chess960 type check default false"
#define OM_UCI_STR "option name OutputMode type combo default Full var None var Basic var PV var Full"
#define HT_UCI_STR "option name Hash type spin default 1 min 1 max 512" // not really bounded

// test the functions above
int opt_test();

#endif // OPTIONS_H_INCLUDED
