#pragma once

#include <common/mutators/base.qh>

// register all possible hooks here

// to use a hook, first register your mutator using REGISTER_MUTATOR
// then create your function using MUTATOR_HOOKFUNCTION

// globals

string cmd_name;
int cmd_argc;
string cmd_string;

/**
 * Called when a menu command is parsed
 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
 * NOTE: return true if you handled the command, return false to continue handling
 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
 * // example:
 * MUTATOR_HOOKFUNCTION(foo, Menu_ConsoleCommand) {
 *     if (MUTATOR_RETURNVALUE) return false; // command was already handled
 *     if (cmd_name == "echocvar" && cmd_argc >= 2) {
 *         print(cvar_string(argv(1)), "\n");
 *         return true;
 *     }
 *     if (cmd_name == "echostring" && cmd_argc >= 2) {
 *         print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
 *         return true;
 *     }
 *     return false;
 * }
 */
#define EV_Menu_ConsoleCommand(i, o) \
	/** command name */ i(string, cmd_name) \
	/** also, argv() can be used */ i(int, cmd_argc) \
	/** whole command, use only if you really have to */ i(string, cmd_string) \
	/**/
MUTATOR_HOOKABLE(Menu_ConsoleCommand, EV_Menu_ConsoleCommand);

#define EV_ConfigureDialogs(i, o) \
	/** main window entity */ i(entity, MUTATOR_ARGV_0_entity) \
	/**/
MUTATOR_HOOKABLE(ConfigureDialogs, EV_ConfigureDialogs);
