#pragma once

#include "Widget.h"

#include <memory>
#include <vector>

class PaintEvent;
class MouseEvent;
class KeyboardEvent;
class VisualLayer;
class IPlatformWindow;
using IPlatformWindowPtr = std::unique_ptr<IPlatformWindow>;

namespace mt
{

class Window
{

public:

    Window();

    ~Window();

    static std::unique_ptr<Window> Create();

    void AddWidget(WidgetUPtr widget);

    Widget* GetWidget() const;

    std::vector<VisualLayer*> GetLayers();

    unsigned GetWidth() const;

    unsigned GetHeight() const;

    void SetSize(unsigned width, unsigned height);

    void OnPaint(const PaintEvent* event);

    void OnMouseEvent(const MouseEvent* event);

    void OnKeyboardEvent(const KeyboardEvent* event);

    IPlatformWindow* GetPlatformWindow() const;

    void SetPlatformWindow(IPlatformWindowPtr window);

private:
    int mHandle {-1};
    WidgetUPtr mWidget {nullptr};
    unsigned mWidth {800};
    unsigned mHeight {600};
    IPlatformWindowPtr mPlatformWindow {nullptr};
};
}

using WindowUPtr = std::unique_ptr<mt::Window>;
