#pragma once
#include <drogon/exports.h>
#include <vector>
#include <string>
#include <memory>
#include <functional>
struct redisReply;
namespace drogon
{
namespace nosql
{
enum class RedisResultType
{
    kInteger = 0,
    kString,
    kArray,
    kStatus,
    kNil,
    kError
};
class DROGON_EXPORT RedisResult
{
  public:
    explicit RedisResult(redisReply *result) : result_(result)
    {
    }
    ~RedisResult() = default;
    RedisResultType type() const noexcept;
    std::string asString() const noexcept(false);
    std::vector<RedisResult> asArray() const noexcept(false);
    long long asInteger() const noexcept(false);
    std::string getStringForDisplaying() const noexcept;
    std::string getStringForDisplayingWithIndent(
        size_t indent = 0) const noexcept;
    bool isNil() const noexcept;
    explicit operator bool() const
    {
        return !isNil();
    }
  private:
    redisReply *result_;
};
using RedisResultCallback = std::function<void(const RedisResult &)>;
using RedisMessageCallback =
    std::function<void(const std::string &channel, const std::string &message)>;
}  
}  