local renderableHelper = asset.require("./renderable_helper")

-- Function that schedules scripts setting the enabled property 
-- of <renderable> to <enabled> at time <time>.
local scheduleRenderableEnabled = function(time, renderable, enabled)
  openspace.scriptScheduler.loadScheduledScript(
    time,
    renderableHelper.setEnabled(renderable, enabled)
  )
end

-- Function that schedules scripts setting the enabled property 
-- of <renderable> to <enabled> when time <time> is passed
-- and inverts it if time is passed in reversed order.
local scheduleRenderableEnabledReversable = function(time, renderable, enabled)
  openspace.scriptScheduler.loadScheduledScript(
    time,
    renderableHelper.setEnabled(renderable, enabled),
    renderableHelper.setEnabled(renderable, not enabled)
  )
end

asset.export("scheduleRenderableEnabledReversable", scheduleRenderableEnabledReversable)
asset.export("scheduleRenderableEnabled", scheduleRenderableEnabled)
