#ifndef SRC_CORE_CORES_HPP_
#define SRC_CORE_CORES_HPP_

#include "src/core/settings.hpp"
#include "src/core/version.hpp"
#include "src/core/json.hpp"
#include <functional>

struct RetroArchVersion {
	Version version;
	bool lock;
};

struct InstalledVersionsInfo {
	RetroArchVersion retroArchVersion;
	Version parallelVersion;
	int64 lastUpdateCheck;

	static const InstalledVersionsInfo Default;
};

struct ParallelCoreVersion {
	Version version;
	string sha1;
	string downloadUrl;
};

namespace JsonSerializer {
	template<> void serialize<RetroArchVersion>( JsonWriter &jw, const RetroArchVersion &obj );
	template<> RetroArchVersion parse<RetroArchVersion>( const Json &json );

	template<> void serialize<InstalledVersionsInfo>( JsonWriter &jw, const InstalledVersionsInfo &obj );
	template<> InstalledVersionsInfo parse<InstalledVersionsInfo>( const Json &json );

	template<> ParallelCoreVersion parse<ParallelCoreVersion>( const Json &json );
}

namespace ParallelCoreBuilds {

	void getLatest(
		const std::function<void(const ParallelCoreVersion&)> &onSuccess,
		const std::function<void(void)> &onFailure
	);

}

namespace RetroUpdater {

	extern void checkForUpdates(
		bool waitForCoreUpdates,
		bool forceUpdate
	);

}

#endif /* SRC_CORE_CORES_HPP_ */
