#ifndef BACKPACK_HPP_
#define BACKPACK_HPP_

#include <Item/IEquipment.hpp>
#include <Item/StatefulItem/Bag/Bag.hpp>

struct BackpackExtraState
{
    std::string label;
    RGBABytes color;

    BackpackExtraState();

    void randomizeColor();

    bool operator==(const BackpackExtraState &other) const;
};

DERIVE_STRUCT_SERIALIZER(BackpackExtraState, self.label, self.color);

class Backpack final :
    public Bag<20, BackpackExtraState>,
    public IEquipment
{
public:
    Backpack(std::string name);

    virtual std::string getDisplayName(const ItemStack &stack) override;
    virtual void draw(GraphicsContext &context, int x, int y, const ItemStack &stack) override;
    virtual void draw3D(GraphicsContext &context, WorldDisplay &worldDisplay, glm::vec3 pos, ItemStack &stack) override;
    virtual void drawFlat(GraphicsContext &context, WorldDisplay &worldDisplay, glm::mat4 matrix, ItemStack &stack) override;
    virtual void getExtraToolTipLines(const ItemStack &stack, ToolTip &tip) override;
    virtual bool canMerge(const ItemStack &a, const ItemStack &b) override;
    virtual void onPickedUpInCheatBook(ItemStack &stack) override;
    virtual Widget* createBagWidget(InventoryController &ctrl, const std::string &bagInvId, ItemStack &stack, int equipmentSlot) override;
};

#endif