#ifndef PLAYER_TRIGGER_REGISTRY_HPP_
#define PLAYER_TRIGGER_REGISTRY_HPP_

#include <Entity/PhysicsEntity/CameraEntity/Player/Player.hpp>
#include <unordered_map>
#include <string>
#include <utility>

/**
 * @brief A registry which maps player 'trigger' strings to achievements.
 *
 * A trigger string is a representation of an action that a player may perform.
 * For example, when a player collects an item, the 'main:ItemCollected::<name>' trigger
 * is raised; e.g. when a stick is collected, the trigger string will be
 * 'main:ItemCollected::main:stick'. Such a string can be mapped via this registry to
 * an achievement, and the achivement will be obtained by the player who causes this
 * trigger string to be raised.
 */
extern class PlayerTriggerRegistry
{
private:
    std::unordered_map<std::string, std::pair<std::string, int>> triggerMap;

    void when(std::string trigger, std::string milestoneId, int achievementId);
    void whenItemCollected(std::string name, std::string milestoneId, int achievementId);
    void whenBlockCollected(std::string name, std::string milestoneId, int achievementId);
    void whenItemEquipped(std::string name, std::string milestoneId, int achievementId);
    void whenItemMoved(std::string name, std::string milestoneId, int achievementId);
    void whenBlockMoved(std::string name, std::string milestoneId, int achievementId);
    void whenFluidCollected(std::string name, std::string milestoneId, int achievementId);
    void whenBlockPlaced(std::string name, std::string milestoneId, int achievementId);

public:
    void registerAllTriggers();
    void raise(Player &player, std::string trigger);
} playerTriggerRegistry;

#endif