#include <iostream>
#include <director/director.h>
#include <mind.h>
#include <goal.h>

namespace smo {
namespace director {

Director::Director(
	Mind &parent, const std::shared_ptr<sscl::PuppetThread> &thread)
:	MindComponent(static_cast<sscl::PuppetApplication&>(parent), thread)
{
}

void Director::negtrinEventInd(void)
{
	/**	EXPLANATION:
	 * The essence of a negtrin event, to Director is that it generates a new Goal
	 * object and enqueues it onto the Director's negtrins queue. It's this auto-goal 
	 * generation that gives negtrins their intrinsic undesirability.
	 *
	 * We don't sample the negtrin, evaluate it and then conclude that it's
	 * undesirable. We don't even produce a negative value judgment. We skip
	 * right past both the evaluation and the value judgment production and
	 * just generate the goal immediately.
	 *
	 * I'm unsure whether this is correct: it may well be that we ought to
	 * simply produce a negative value judgment and then let the Director
	 * create a goal to alleviate the negtrin.
	 *
	 * At any rate, for now, this is our implementation.
	 */
    std::cout << __func__ << ": Handling negtrin event." << std::endl;
}

void Director::intrinEventInd(void)
{
    std::cout << __func__ << ": Handling intrin event." << std::endl;
}

void Director::postrinEventInd(void)
{
	/**	EXPLANATION:
	 * When a postrin event occurs, a goal is auto-generated, but this goal is
	 * a bit different from the goals that are auto-generated for negtrins.
	 *
	 * A negtrin's goal is to either: get to 0; reduce the negtrin below its
	 * intolerable threshold; or reduce it somewhat even if not below the
	 * tolerable threshold. This is very easy to represent as a cologex.
	 *
	 * A postrin's goal is to: persist the postrin indefinitely; and increase
	 * its intensity if possible; and to store it away as something worth
	 * re-triggering if some external distractor/frustrator interrupts the
	 * persistent sampling of the postrin.
	 *
	 * I can think of how to encode the negtrin goal as a cologex, but I can't
	 * think of how to encode the postrin goal as a cologex.
	 *
	 * With respect to the "store away for future re-triggering" aspect of the
	 * postrin goal we can encode this by merely refusing to remove any postrin
	 * goal from the goal prioQ. I suppose negtrins differ in that we do remove
	 * them from the goal prioQ when they're resolved.
	 */
    std::cout << __func__ << ": Handling postrin event." << std::endl;
}

} // namespace director
} // namespace smo
