#ifndef LAYER_STACK_HPP
#define LAYER_STACK_HPP

#include "open_engine/core.hpp"
#include "open_engine/layer.hpp"

#include <vector>

namespace OpenEngine {
    class LayerStack
    {
        public:
            LayerStack() = default;
            ~LayerStack();

            void QueueLayerPush(Ref<Layer> layer);
            void QueueLayerPop(Ref<Layer> layer);
            void QueueOverlayPush(Ref<Layer> layer);
            void QueueOverlayPop(Ref<Layer> layer);
            void UpdateLayers();

            std::vector<Ref<Layer>>::iterator begin() { return layers.begin(); };
            std::vector<Ref<Layer>>::iterator end() { return layers.end(); };

        private:
            std::vector<Ref<Layer>> layers;
            std::vector<Ref<Layer>> layers_to_pop;
            std::vector<Ref<Layer>> layers_to_push;

            std::vector<Ref<Layer>> overlay_to_pop;
            std::vector<Ref<Layer>> overlay_to_push;

            unsigned int layer_insert_index = 0;
    };
}

#endif // LAYER_STACK_HPP
