local CTXFadeIn = {
  Identifier = "os.mars.CTXFadeIn",
  Name = "Fade in CTX",
  Command = [[
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.CTX_blended_01.Enabled", true)
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.CTX_blended_01.Settings.Opacity", 0.0)
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.CTX_blended_01.Settings.Opacity", 1.0, 2.0)]],
  Documentation = "Enables and fades in CTX layer for Mars",
  GuiPath = "/Solar System/Mars",
  IsLocal = true
}

local CTXFadeOut = {
  Identifier = "os.mars.CTXFadeOut",
  Name = "Fade out CTX layer",
  Command = [[openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.CTX_blended_01.Settings.Opacity", 0.0, 2.0)]],
  Documentation = "Fade out CTX",
  GuiPath = "/Solar System/Mars",
  IsLocal = true
}

local HiriseFadeIn = {
  Identifier = "os.mars.HiriseFadeIn",
  Name = "Fade in HiRISE",
  Command = [[
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.HiRISE-PSP.Enabled", true)
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.HiRISE-PSP.Settings.Opacity", 0.0)
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.HiRISE-PSP.Settings.Opacity", 1.0, 2.0)]],
  Documentation = "Enables and fades in HiRise layer for Mars",
  GuiPath = "/Solar System/Mars",
  IsLocal = true
}

local HiriseFadeOut = {
  Identifier = "os.mars.HiriseFadeOut",
  Name = "Fade out HiRISE",
  Command = [[openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.HiRISE-PSP.Settings.Opacity", 0.0, 2.0)]],
  Documentation = "Fade out HiRISE layer for Mars",
  GuiPath = "/Solar System/Mars",
  IsLocal = true
}

local LocalSetHiriseFadeIn = {
  Identifier = "os.mars.LocalSetHiriseFadeIn",
  Name = "Fade in HiRISE local set",
  Command = [[
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.HiRISE-LS.Enabled", true)
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.HeightLayers.HiRISE-LS-DEM.Enabled", true)
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.HiRISE-LS.Settings.Opacity", 0.0)
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.HiRISE-LS.Settings.Opacity", 1.0, 2.0)]],
  Documentation = "Enables and fades in HiRise local set layers for Mars (including height)",
  GuiPath = "/Solar System/Mars",
  IsLocal = true
}

local LocalSetHiriseFadeOut = {
  Identifier = "os.mars.LocalSetHiriseFadeOut",
  Name = "Fade out HiRISE local set",
  Command = [[
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.ColorLayers.HiRISE-LS.Settings.Opacity", 0.0, 2.0)
openspace.setPropertyValueSingle("Scene.Mars.Renderable.Layers.HeightLayers.HiRISE-LS-DEM.Enabled", false)
]],
  Documentation = "Fade out HiRISE local set layer for Mars",
  GuiPath = "/Solar System/Mars",
  IsLocal = true
}


asset.onInitialize(function()
  openspace.action.registerAction(CTXFadeIn)
  openspace.action.registerAction(CTXFadeOut)
  openspace.action.registerAction(HiriseFadeIn)
  openspace.action.registerAction(HiriseFadeOut)
  openspace.action.registerAction(LocalSetHiriseFadeIn)
  openspace.action.registerAction(LocalSetHiriseFadeOut)
end)

asset.onDeinitialize(function()
  openspace.action.removeAction(LocalSetHiriseFadeOut)
  openspace.action.removeAction(LocalSetHiriseFadeIn)
  openspace.action.removeAction(HiriseFadeOut)
  openspace.action.removeAction(HiriseFadeIn)
  openspace.action.removeAction(CTXFadeOut)
  openspace.action.removeAction(CTXFadeIn)
end)

asset.export("CTXFadeIn", CTXFadeIn.Identifier)
asset.export("CTXFadeOut", CTXFadeOut.Identifier)
asset.export("HiriseFadeIn", HiriseFadeIn.Identifier)
asset.export("HiriseFadeOut", HiriseFadeOut.Identifier)
asset.export("LocalSetHiriseFadeIn", LocalSetHiriseFadeIn.Identifier)
asset.export("LocalSetHiriseFadeOut", LocalSetHiriseFadeOut.Identifier)
