local _,cost,start, duration

WhatsNext:AddConditionalStatement("Minimum Cost",{
	category = "Ability",
	test = function(checkTable) 
		return WhatsNext_GetSpellCost(checkTable.spellName) >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return WhatsNext:GetSpellName(checkTable.spellName) .. " costs at least " .. tostring(checkTable.amount) .. " power."
	end,
	arguments = {
		amount = {label = "Power Cost", type = "integer", default = 0},
		spellName = {label = "Spell", type = "spell", default = ""}
	}
})

WhatsNext:AddConditionalStatement("Maximum Cost",{
	category = "Ability",
	test = function(checkTable) 
		return WhatsNext_GetSpellCost(checkTable.spellName) <= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return WhatsNext:GetSpellName(checkTable.spellName) .. " costs no more than " .. tostring(checkTable.amount) .. " power."
	end,
	arguments = {
		amount = {label = "Power Cost",type = "integer", default = 0},
		spellName = {label = "Spell",type = "spell", default = ""}
	}
})

WhatsNext:AddConditionalStatement("Ability Cooldown",{
	category = "Ability",
	test = function(checkTable)
		start, duration = GetSpellCooldown(WhatsNext:GetSpellName(checkTable.spellName))
		return start and start > 0 and start + duration - GetTime() > tonumber(checkTable.time)
	end,
	text = function(checkTable)
		return WhatsNext:GetSpellName(checkTable.spellName) .. " will be on cooldown for more than " .. tostring(checkTable.time) .. " second(s)."
	end,
	arguments = {
		spellName = {label = "Spell",type = "spell", default = ""},
		time = {label = "Seconds",type = "integer", default = 3}
	}
})
WhatsNext:AddConditionalStatement("Ability Usable",{
	category = "Ability",
	test = function(checkTable)
		return IsUsableSpell(WhatsNext:GetSpellName(checkTable.spellName))
	end,
	text = function(checkTable)
		return WhatsNext:GetSpellName(checkTable.spellName) .. " can be cast if off cooldown."
	end,
	arguments = {
		spellName = {label = "Spell",label="Spell",type = "spell", default = ""},
	}
})
WhatsNext:AddConditionalStatement("Ability Charge Count",{
	category = "Ability",
	test = function(checkTable)
		local chargeCount,maxCharges, cooldownStart, cooldownDuration = GetSpellCharges(WhatsNext:GetSpellName(checkTable.spellName));
		return chargeCount >= tonumber(checkTable.chargeCount)
	end,
	text = function(checkTable)
		return WhatsNext:GetSpellName(checkTable.spellName) .. " has at least " .. checkTable.chargeCount .. " charge(s)."
	end,
	arguments = {
		spellName = {label="Spell",type = "spell", default = ""},
		chargeCount = {label="Charge Count", type = "integer", default = 1, min=1,max=10,increment=1}
	}
})