
WhatsNext:AddConditionalStatement("Minimum Health",{
	category = "Health",
	test = function(checkTable) 
		local health = UnitHealth(tostring(checkTable.unit))
		return health and health >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return tostring(checkTable.unit) .. "'s health is at or above " .. tostring(checkTable.amount) .. "."
	end,
	arguments = {
		unit = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		amount = {type = "integer", default = 0}
	}
})

WhatsNext:AddConditionalStatement("Minimum Health Percent",{
	category = "Health",
	test = function(checkTable) 
		local health = UnitHealth(tostring(checkTable.unit))
		local maxHealth = UnitHealthMax(tostring(checkTable.unit))
		return health and maxHealth and maxHealth > 0 and tonumber(checkTable.amount) <= health / maxHealth
	end,
	text = function(checkTable) 
		local amountNum = tonumber(checkTable.amount)
		return tostring(checkTable.unit) .. "'s health is at or above " .. tostring(amountNum and amountNum*100 or checkTable.amount) .. "%."
	end,
	arguments = {
		unit = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		amount = {type = "percent", default = .5}
	}
})

WhatsNext:AddConditionalStatement("Maximum Health",{
	category = "Health",
	test = function(checkTable) 
		local health = UnitHealth(tostring(checkTable.unit))
		return health and health <= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return tostring(checkTable.unit) .. "'s health is at or below " .. tostring(checkTable.amount) .. "."
	end,
	arguments = {
		unit = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		amount = {type = "integer", default = 0}
	}
})

WhatsNext:AddConditionalStatement("Maximum Health Percent",{
	category = "Health",
	test = function(checkTable) 
		local health = UnitHealth(tostring(checkTable.unit))
		local maxHealth = UnitHealthMax(tostring(checkTable.unit))
		return health and maxHealth and maxHealth > 0 and tonumber(checkTable.amount) >= health / maxHealth
	end,
	text = function(checkTable) 
		local amountNum = tonumber(checkTable.amount)
		return tostring(checkTable.unit) .. "'s health is at or below " .. tostring(amountNum and amountNum*100 or checkTable.amount) .. "%."
	end,
	arguments = {
		unit = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		amount = {type = "percent", default = .5}
	}
})

WhatsNext:AddConditionalStatement("Minimum Missing Health",{
	category = "Health",
	test = function(checkTable) 
		local health = UnitHealth(tostring(checkTable.unit))
		local maxHealth = UnitHealthMax(tostring(checkTable.unit))
		return health and maxHealth and maxHealth - health >= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return tostring(checkTable.unit) .. "'s health is at least " .. tostring(checkTable.amount) .. " below their maximum health."
	end,
	arguments = {
		unit = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		amount = {type = "integer", default = 0}
	}
})

WhatsNext:AddConditionalStatement("Maximum Missing Health",{
	category = "Health",
	test = function(checkTable) 
		local health = UnitHealth(tostring(checkTable.unit))
		local maxHealth = UnitHealthMax(tostring(checkTable.unit))
		return health and maxHealth and maxHealth - health <= tonumber(checkTable.amount)
	end,
	text = function(checkTable) 
		return tostring(checkTable.unit) .. "'s health is no more than " .. tostring(checkTable.amount) .. " below their maximum health."
	end,
	arguments = {
		unit = {type = "dropdown", default = "player", possibleValues = WhatsNext.valueLists.unitAny},
		amount = {type = "integer", default = 0}
	}
})