if BF then
	BF.exports.HotfixCore = {}
else
	HotfixCore = {}
end

local util = require "app/hotfix/util"

HotfixCore.public = xlua.hotfix

HotfixCore.public_ex = util.hotfix_ex

HotfixCore.private = function (class, funcName, fixFunc)
	xlua.private_accessible(class)
	xlua.hotfix(class, funcName, fixFunc)
end

HotfixCore.private_ex = function (class, funcName, fixFunc)
	xlua.private_accessible(class)
	util.hotfix_ex(class, funcName, fixFunc)
end

HotfixCore.ienumerator = function (class, funcName, callback)
	xlua.hotfix(class, funcName, function ()
		return util.cs_generator(callback)
	end)
end

HotfixCore.ienumerator_private = function (class, funcName, callback)
	xlua.private_accessible(class)
	xlua.hotfix(class, funcName, function ()
		return util.cs_generator(callback)
	end)
end

--------------------------------------------------------

HotfixCore.execute = function (luaTemplate, class, funcCfg)
	for hotfixType, array in pairs(funcCfg) do
		local hotfixFunc = HotfixCore[hotfixType]
		if hotfixFunc then
			for _, funcName in ipairs(array) do
				if luaTemplate[funcName] then
					hotfixFunc(class, funcName, luaTemplate[funcName])
				end
			end
		end
	end
end