local unit

WhatsNext:AddConditionalStatement("Time Till Death",{
	category = "Death Clocks",
	test = function(checkTable) 
		unit = DeathClock and DeathClock.units and DeathClock.units[UnitGUID(tostring(checkTable.unit))]
		return unit and unit.time and unit.time <= tonumber(checkTable.time) 
	end,
	text = function(checkTable) 
		return GetUnitDisplayText(checkTable.unit) .. " is expected to die within " .. tostring(checkTable.time) .. " seconds. (Requires the Death Clocks addon)"
	end,
	arguments = {
		unit = {type = "dropdown", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		time = {type = "integer", default = 0},
	}
})

WhatsNext:AddConditionalStatement("Life Expectancy",{
	category = "Death Clocks",
	test = function(checkTable) 
		unit = DeathClock and DeathClock.units and DeathClock.units[UnitGUID(tostring(checkTable.unit))]
		return unit and unit.time and unit.time >= tonumber(checkTable.time) 
	end,
	text = function(checkTable) 
		return GetUnitDisplayText(checkTable.unit) .. " is expected to live for at least " .. tostring(checkTable.time) .. " seconds. (Requires the Death Clocks addon)"
	end,
	arguments = {
		unit = {type = "dropdown", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		time = {type = "integer", default = 0},
	}
})