#ifndef MAINSCREEN_HPP_INCLUDED
#define MAINSCREEN_HPP_INCLUDED

#include "../../Core/Types/Box.hpp"
#include "../../Core/Types/Tile.hpp"
#include "../../Core/Classes/Character.hpp"
#include <cstdint>
#include <string>
#include <vector>
#include <functional>

/**
* @brief A namespace containing various functions related to the Mainscreen
*/
namespace Mainscreen
{
    typedef enum SCREEN_STATE
    {
        LOGIN_SCREEN,
        LOBBY_SCREEN,
        CONNECTING,
        LOADING,
        HOPPING,
        PLAYING
    } SCREEN_STATE;

    typedef enum CROSSHAIR_STATE
    {
        NONE,
        YELLOW,
        RED
    } CROSSHAIR_STATE;

    Mainscreen::SCREEN_STATE GetState();
    Mainscreen::CROSSHAIR_STATE GetCrosshairState();

    /**
     * @brief Returns true if the Mainscreen SCREEN_STATE is PLAYING, LOADING, or HOPPING
     * @return True if the Mainscreen SCREEN_STATE is PLAYING, LOADING, or HOPPING
     */
    bool IsLoggedIn();
    /**
     * @brief Returns true if the player is moving
     * @return True if the player is moving
     * @details P.GetPoseAnimationID() != P.GetSubPoseAnimationID()
     */
    bool IsMoving();
    /**
    * @brief Returns true if the player is animating
    * @return True if the player is animating
    * @details P.GetAnimationID() != -1
    */
    bool IsAnimating();

    std::string GetUpText();

    bool IsUpText(const std::string& UpText);
    bool IsUpText(const std::vector<std::string>& UpTexts);

    bool UpTextContains(const std::string& UpText);
    bool UpTextContains(const std::vector<std::string>& UpTexts);
    bool UpTextContains(const std::string& UpText, std::uint32_t CheckTime, std::uint32_t FailCheckTime);
    bool UpTextContains(const std::vector<std::string>& UpTexts, std::uint32_t CheckTime, std::uint32_t FailCheckTime);

    bool WaitIsUpText(std::uint32_t Duration, std::uint32_t Step, const std::string& UpText);

    bool WaitUpTextContains(std::uint32_t Duration, std::uint32_t Step, const std::string& UpText);
    bool WaitUpTextContains(std::uint32_t Duration, std::uint32_t Step, const std::vector<std::string>& UpTexts);

    bool IsTileOn(const Tile& T);
    bool ClickTile(const Tile& T);

    bool WalkPath(const std::vector<Tile>& Path, std::int32_t Distance);
    bool WalkPath(const std::vector<Tile>& Path, std::int32_t Distance, std::function<bool()> Func);

    std::vector<Box> GetBlockingWidgetBoxes();
}

#endif // MAINSCREEN_HPP_INCLUDED
