local unit

WhatsNext:AddConditionalStatement("Time Till Death",{
	category = "Death Clocks",
	text = "{unit} is expected to die within {time} seconds. (Requires the Death Clocks addon)",
	test = function(checkTable) 
		local time = DeathClock_TimeTillDeath and DeathClock_TimeTillDeath(checkTable.unit);
		return time and time <= tonumber(checkTable.time) 
	end,
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		time = {label = "Seconds", type = "integer", default = 3, min = 1, max = 60},
	}
})

WhatsNext:AddConditionalStatement("Life Expectancy",{
	category = "Death Clocks",
	text = "{unit} is expected to live for at least {time} seconds. (Requires the Death Clocks addon)",
	test = function(checkTable) 
		local time = DeathClock_TimeTillDeath and DeathClock_TimeTillDeath(checkTable.unit);
		return time and time >= tonumber(checkTable.time) 
	end,
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		time = {label = "Seconds", type = "integer", default = 3, min = 1, max = 60},
	}
})

WhatsNext:AddConditionalStatement("Time Till Execute Range",{
	category = "Death Clocks",
	text = "{unit} is expected to enter execute range within {time} seconds. (Requires the Death Clocks addon)",
	test = function(checkTable) 
		local time = DeathClock_TimeTillExecuteRange and DeathClock_TimeTillExecuteRange(checkTable.unit);
		return time and time <= tonumber(checkTable.time) 
	end,
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		time = {label = "Seconds", type = "integer", default = 3, min = 1, max = 60},
	}
})

WhatsNext:AddConditionalStatement("Time Out Of Execute Range",{
	category = "Death Clocks",
	text = "{unit} is expected to remain out of execute range for at least {time} seconds. (Requires the Death Clocks addon)",
	test = function(checkTable) 
		local time = DeathClock_TimeTillExecuteRange and DeathClock_TimeTillExecuteRange(checkTable.unit);
		return time and time >= tonumber(checkTable.time) 
	end,
	arguments = {
		unit = {label = "Unit", type = "unit", default = "target", possibleValues = WhatsNext.valueLists.unitAny},
		time = {label = "Seconds", type = "integer", default = 3, min = 1, max = 60},
	}
})