#pragma once
#include <cstdint>
#include <functional>
#include <map>
#include <string>
#include <string_view>
#include <unordered_map>
#include "utils.hpp"
namespace ddwaf {
enum class action_type : uint8_t {
none = 0,
unknown = 1,
generate_stack = 2,
generate_schema = 3,
monitor = 4,
block_request = 5,
redirect_request = 6, };
action_type action_type_from_string(std::string_view type);
inline bool is_blocking_action(action_type type)
{
return type == action_type::block_request || type == action_type::redirect_request;
}
inline bool is_modal_action(action_type type)
{
return type == action_type::monitor || is_blocking_action(type);
}
struct action_parameters {
action_type type;
std::string type_str;
std::unordered_map<std::string, scalar_type> parameters;
};
using action_mapper = std::map<std::string, action_parameters, std::less<>>;
}