local _, addonTable = ...

local Caching = {}

-- Locals
local IsInitializing = true
local itemsPrimed = 0
local itemsToPrime = 100
-- Upvalues
local UnitFactionGroup = UnitFactionGroup

function Caching:IsHorde()
	if Spearity.isHorde == nil then
		local englishFaction, localizedFaction = UnitFactionGroup("player")
		if englishFaction == "Horde" then
			Spearity.isHorde = true
		else
			Spearity.isHorde = false
		end
	end
	return Spearity.isHorde
end

function Caching:IsAlliance()
	if Spearity.isAlliance == nil then
		local englishFaction, localizedFaction = UnitFactionGroup("player")
		if englishFaction == "Alliance" then
			Spearity.isAlliance = true
		else
			Spearity.isAlliance = false
		end
	end
	return Spearity.isAlliance
end

function Caching:IsReady()
	return not IsInitializing
end

function Caching:SetReadyState(status)
	IsInitializing = not status
end

function Caching:SetPrimedItems(number)
	itemsPrimed = number
end

function Caching:GetPrimedItems()
	return itemsPrimed
end

function Caching:SetItemsToPrime(number)
	itemsToPrime = number
end

function Caching:GetItemsToPrime()
	return itemsToPrime
end

Spearity.Caching = Caching
return Caching
