/**************************************************************************/
/*  aethex_asset_library.h                                                */
/**************************************************************************/
/*                       AeThex Engine                                    */
/*                    https://aethex.dev                                  */
/**************************************************************************/

#ifndef AETHEX_ASSET_LIBRARY_H
#define AETHEX_ASSET_LIBRARY_H

#include "core/object/ref_counted.h"

class AethexCloud;

class AethexAssetLibrary : public RefCounted {
    GDCLASS(AethexAssetLibrary, RefCounted);

private:
    AethexCloud *cloud = nullptr;

protected:
    static void _bind_methods();

public:
    void set_cloud(AethexCloud *p_cloud);

    // Browse assets
    Dictionary search(const String &p_query = "", const String &p_category = "", int p_page = 1, int p_per_page = 20);
    Dictionary get_asset(const String &p_asset_id);
    Dictionary get_categories();

    // Download
    Dictionary download_asset(const String &p_asset_id, const String &p_destination);

    // Publish from editor
    Dictionary publish_asset(const String &p_name, const String &p_description, const String &p_category, const PackedByteArray &p_data);

    // Async
    void search_async(const String &p_query, const String &p_category, const Callable &p_callback);
    void download_async(const String &p_asset_id, const String &p_destination, const Callable &p_callback);

    AethexAssetLibrary();
    ~AethexAssetLibrary();
};

#endif // AETHEX_ASSET_LIBRARY_H
