// GLCanvasManager.h
#ifndef GLCANVASMANAGER_H
#define GLCANVASMANAGER_H

#include <js_native_api.h>
#include <js_native_api_types.h>
#include <napi/native_api.h>
#include <unordered_map>
#include <native_window/external_window.h>

#include "GLCanvas/GLCanvas.h"
#include "RNGLContext/RNGLContext.h"

class GLCanvasManager {
public:
    ~GLCanvasManager();
    static int64_t ParseId(napi_env env, napi_callback_info info);
    static GLCanvas *GetGLCanvas(int64_t &id);
    static napi_value SetSurfaceId(napi_env env, napi_callback_info info);
    static napi_value ChangeSurface(napi_env env, napi_callback_info info);
    static napi_value DestroySurface(napi_env env, napi_callback_info info);
    
    static napi_value AddShader(napi_env env, napi_callback_info info);
    static napi_value RemoveShader(napi_env env, napi_callback_info info);
    static napi_value SetData(napi_env env, napi_callback_info info);
    static napi_value DrawFrame(napi_env env, napi_callback_info info);
    static napi_value LoadImage(napi_env env, napi_callback_info info);
    static napi_value OnProgress(napi_env env, napi_callback_info info);
    static napi_value GetContext(napi_env env, napi_callback_info info);

public:
    static std::unordered_map<int64_t, GLCanvas *> glCanvasMap_;
    static std::unordered_map<int64_t, OHNativeWindow *> windowMap_;
    static std::shared_ptr<RNGLContext> rnglContext_;

};

#endif // GLCANVASMANAGER_H