#pragma once

#include <list>
#include <cstdint>
#include <game/level/entity.h>
#include <game/interface/resourceProvider.h>

namespace game{

class basicPipe: public entity, public virtual resourceProvider
{
public:
    basicPipe(const vec2f &pos, const vec2u &size, level*);
    virtual ~basicPipe() = default;

    float require(uint item, float amount) noexcept;
    virtual float add(uint item, float amount) noexcept;

    uint getItemType() const noexcept;

    virtual void update();

    virtual void onNeighbourCreated(entity*);
    virtual void beforeNeighbourDestroyed(entity*);

    float getFilledSpace();
protected:
    float _capacity;
    uint32_t _item;
    float _amount;
    std::list<basicPipe*> _connections;
};

}
