/*
 * GoalPhysicsComponent.h
 *
 *  Created on: Aug 14, 2020
 *      Author: fredrick
 */

#ifndef GOALPHYSICSCOMPONENT_H_
#define GOALPHYSICSCOMPONENT_H_

#include <chrono>
#include <memory>
#include <cstdint>
#include <string>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>

#include <ecos/core/IDCache.h>
#include <ecos/core/Log.h>
#include <ecos/core/Message.h>
#include <ecos/core/BroadcastObservable.h>
#include <ecos/physics/PhysicsSystem.h>
#include <ecos/physics/TransformChangeMessage.h>
#include <ecos/physics/CollisionStateChangeMessage.h>
#include <ecos/physics/ColliderQueryMessage.h>
#include <ecos/physics/PhysicsComponent.h>
#include <ecos/physics/Collider.h>

namespace JamSpook {

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

using glm::vec3;
using glm::mat4;
using glm::translate;
using glm::scale;

using ecos::core::IDCache;
using ecos::core::logging::Log;
using ecos::core::logging::LogLevel;
using ecos::core::Message;
using ecos::core::BroadcastObservable;
using ecos::physics::PhysicsSystem;
using ecos::physics::PhysicsComponent;
using ecos::physics::Collider;
using ecos::physics::TransformChangeMessage;
using ecos::physics::CollisionStateChangeMessage;
using ecos::physics::ColliderQueryMessage;

///
class GoalPhysicsComponent:
        public PhysicsComponent
{
public:
    GoalPhysicsComponent(mat4 transform,
                         shared_ptr<BroadcastObservable<shared_ptr<Message> > > entity,
                         weak_ptr<BroadcastObservable<const milliseconds> > physicsSystem,
                         weak_ptr<BroadcastObservable<shared_ptr<CollisionStateChangeMessage> > > physicsCollisionSubSystem,
                         weak_ptr<BroadcastObservable<shared_ptr<ColliderQueryMessage> > > physicsColliderQuerySubSystem,
                         shared_ptr<Collider> collider);
    virtual ~GoalPhysicsComponent();

    virtual void update(const milliseconds dtms);
    virtual void onICCMessage(shared_ptr<Message> message);
    virtual void onCollision(const string& tag);
};

} // namespace JamSpook

#endif // GOALPHYSICSCOMPONENT_H_
