/*
 * LightInteractionComponent.h
 *
 *  Created on: Mar 1, 2019
 *      Author: fredrick
 */

#ifndef LIGHTINTERACTIONCOMPONENT_H_
#define LIGHTINTERACTIONCOMPONENT_H_

#include <chrono>
#include <memory>
#include <string>

#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>

#include <ecos/utility/Math.h>
#include <ecos/core/Log.h>
#include <ecos/core/BroadcastObservable.h>
#include <ecos/core/Message.h>
#include <ecos/physics/TransformChangeMessage.h>
#include <ecos/interaction/InteractionSystem.h>
#include <ecos/interaction/InteractionComponent.h>

#include "../messages/DirectionChangeMessage.h"

namespace JamSpook {

using std::chrono::milliseconds;
using std::shared_ptr;
using std::make_shared;
using std::weak_ptr;
using std::dynamic_pointer_cast;

using glm::vec3;
using glm::mat4;
using glm::translate;
using glm::rotate;
using glm::radians;

using ecos::utility::getTranslation;
using ecos::core::logging::Log;
using ecos::core::logging::LogLevel;
using ecos::core::BroadcastObservable;
using ecos::core::Message;
using ecos::physics::TransformChangeMessage;
using ecos::interaction::InteractionSystem;
using ecos::interaction::InputDeviceState;
using ecos::interaction::ButtonState;
using ecos::interaction::InteractionComponent;

/// Player interaction component
/// Player entity specific interaction system code
class LightInteractionComponent :
        public InteractionComponent
{
private:
    vec3 oldDirection;                  ///< Used to construct the DirectionChangeMessaage

public:
    LightInteractionComponent(mat4 transform,
                              shared_ptr<BroadcastObservable<shared_ptr<Message> > > entity,
                              weak_ptr<InteractionSystem> wInteractionSystem);
    virtual ~LightInteractionComponent();

    virtual void onInputDeviceStateChange(const InputDeviceState inputDeviceState);
    virtual void onICCMessage(shared_ptr<Message> message);
};

} // namespace JamSpook

#endif // LIGHTINTERACTIONCOMPONENT_H_
