#ifndef FZ_UTIL_UTF8_NAME_MAP_HPP
#define FZ_UTIL_UTF8_NAME_MAP_HPP

#include <libfilezilla/string.hpp>

#ifndef FZ_UTIL_UTF8_NAME_MAP_CASE_INSENSITIVE
#	ifdef FZ_WINDOWS
#		define FZ_UTIL_UTF8_NAME_MAP_CASE_INSENSITIVE 1
#	else
#		define FZ_UTIL_UTF8_NAME_MAP_CASE_INSENSITIVE 0
#	endif
#endif

#if FZ_UTIL_UTF8_NAME_MAP_CASE_INSENSITIVE
#	include <map>
#else
#	include <unordered_map>
#endif

namespace fz::util {

#if FZ_UTIL_UTF8_NAME_MAP_CASE_INSENSITIVE
struct case_insensitive_utf8_less
{
	bool operator()(const std::string &lhs, const std::string &rhs) const
	{
		return fz::stricmp(fz::to_wstring_from_utf8(lhs), fz::to_wstring_from_utf8(rhs)) < 0;
	}
};

template <typename T>
using utf8_name_map = std::map<std::string /*name*/, T, case_insensitive_utf8_less>;
#else
template <typename T>
using utf8_name_map = std::unordered_map<std::string /*name*/, T>;
#endif

}

#endif // FZ_UTIL_UTF8_NAME_MAP_HPP
