asset.require("spice/base")
local transforms = asset.require("../transforms")
local kernel = asset.require("../kernels")



local IoTrail = {
  Identifier = "IoTrail",
  Parent = transforms.JupiterBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "IO",
      Observer = "JUPITER BARYCENTER"
    },
    Color = { 0.4, 0.4, 0.2 },
    Period = 42.0 / 24.0,
    Resolution = 1000
  },
  Tag = { "moonTrail_solarSystem", "moonTrail_giants", "moonTrail_jupiter", "moonTrail_major_jupiter" },
  GUI = {
    Name = "Io Trail",
    Path = "/Solar System/Planets/Jupiter/Major Moons/Io"
  }
}


asset.onInitialize(function()
  openspace.spice.loadKernel(kernel.jup365)

  openspace.addSceneGraphNode(IoTrail)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(IoTrail)

  openspace.spice.unloadKernel(kernel.jup365)
end)

asset.export(IoTrail)



asset.meta = {
  Name = "Io Trail",
  Version = "1.1",
  Description = [[Trail of Io as observed by the Jupiter. Data from NASA Spice (see
    base spice asset)]],
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
