#pragma once

#include <Button.h>
#include <Image.h>

#include "Chat.h"
#include "Dialog.h"
#include "DragController.h"
#include "ItemList.h"
#include "MapWindow.h"
#include "Menu.h"

class Player;
class InventoryDragSource;

class Game : public Menu
{
private:
    Framework::Button* logout;
    Framework::TextField* debug;
    Framework::Array<UIMLDialog*> dialogs;
    Framework::UIMLView* guiView;
    Framework::UIMLView* targetUIMLView;
    DragController<InventoryDragSource, int>* inventoryDragController;
    Framework::TextField* filter;
    Framework::ImageView* searchIcon;
    ItemListContainer* itemListContainer;
    Framework::Button* chatButton;
    MapWindow* mapWindow;
    Chat* chat;
    bool recipieVisible;
    ReadWriteLock dialogLock;

public:
    // Konstruktor
    Game(Screen* zScreen);
    ~Game();

    void updatePosition(Vec3<float> position, bool target, Vec3<int> targetPos);
    void api(char* data);
    void closeCurrentDialog();
    DragController<InventoryDragSource, int>* zInventoryDragController();
    void setTargetUIML(Framework::Text uiml);

    void updateRecipieVisibility();
    void showItemList();
    bool isItemListVisible();
    const Text* zFilterText();
    void makeChatButtonVisible();
    Chat* zChat() const;
    MapWindow* zMap() const;
    void hide() override;
};

class ScreenCenter : public Framework::Drawable
{
public:
    ScreenCenter();
    virtual void render(Image& zRObj) override;
};