#pragma once

#include <string>
#include <deque>
#include <list>

#include <glm/vec2.hpp>
#include <glm/vec3.hpp>

namespace game {
    class Ship;
    class Command;
    class Missile;

    class Player {
    public:
        size_t     id;
        bool       alive;
        float      speed;
        float      energy;
        float      deadTimeCounter;
        glm::vec3  color;
        Ship      *ship;
        std::string name;
        std::list<Missile*> missiles;

        Player(size_t id) : id(id), alive(true), speed(1.0), energy(0.0), ship(nullptr), name("<unnamed>")
        {
            float h = ((float) rand()) / (float) RAND_MAX;
            float s = ((float) rand()) / (float) RAND_MAX;
            float v = ((float) rand()) / (float) RAND_MAX;
            color =glm::vec3(h,s,v);//glm::gtx::color_space::rgbColor( glm::vec3(h/360.0,1,1)) ;
        }

        void addCommand(Command *cmd);
        bool hasCommandInQueue();

        Command *peekCommand();
        void popCommand();

    private:
        std::deque<Command*> commands;
    };
}
