#ifndef KRIMI_DINNER_ENGINE_ANDROIDASSETMANAGER_H
#define KRIMI_DINNER_ENGINE_ANDROIDASSETMANAGER_H

#include "AssetManager.h"

class AndroidAssetManager : public AssetManager
{
public:
    /// @brief Creates the singleton instance
    ///
    /// Sets @ref AssetManager::ptr to the singleton instance
    /// \param android_asset_manager Pointer to the android asset manager object
    static void create(AAssetManager* android_asset_manager);

    bool loadFile(const char* path, FileBuffer* p_file_buffer) override;

    void releaseFileBuffer(FileBuffer& fb) override;

    /// @brief Write data to a file.
    /// @param path Path relative to the asset root directory
    /// @param data Data buffer
    /// @param size Number of bytes
    /// @return @c true if writing the file was successfull, @c false otherwise
    bool writeFile(const char* path, const void* data, size_t size);

    bool loadInternFile(const char* path, FileBuffer* p_file_buffer);
    size_t getInternFileSize(const char* path);

private:
    AndroidAssetManager();
    ~AndroidAssetManager();

    AAssetManager* m_asset_mgr;
};

#endif
