local proceduralGlobes = asset.require("util/procedural_globe")
local transforms = asset.require("./transforms")
local kernel = asset.require("./kernels").ura112



local parentIdentifier = transforms.UranusBarycenter.Identifier
local parentSpice = "URANUS BARYCENTER"
local tags = { "moon_solarSystem", "moon_giants", "moon_uranus", "moon_irregular_prograde", "moon_minor" }
local trailColor = { 0.60, 0.65, 0.84 }
local trailTags = { 
  "moonTrail_solarSystem",
  "moonTrail_giants",
  "moonTrail_uranus",
  "moonTrail_minor"
}

local irregularMoons = {
  {
    Identifier = "Margaret",
    Parent = {
      Identifier = parentIdentifier,
      Spice = parentSpice
    },
    Spice = "MARGARET",
    Radii = { 20000, 20000, 20000 },
    Tags = tags,
    TrailTags = trailTags,
    GUI = {
      Path = "/Solar System/Planets/Uranus/Moons/Irregular Prograde Moons"
    },
    TrailColor = trailColor,
    OrbitPeriod = 1694.8,
    Kernels = kernel
  }
}

local nodes = proceduralGlobes.createGlobes(irregularMoons)

asset.onInitialize(function()
  for _, node in ipairs(nodes) do
    openspace.addSceneGraphNode(node)
  end
end)
  
asset.onDeinitialize(function()
  for i = #nodes, 1, -1 do
    openspace.removeSceneGraphNode(nodes[i])
  end
end)
  
for _, node in ipairs(nodes) do
  asset.export(node)
end


asset.meta = {
  Name = "Uranus Irregular Prograde Moons",
  Version = "1.0",
  Description = [[Procedural Globe asset containing Uranus' irregular prograde moon:
    Margaret. A blank globe and SPICE trail are generated for the moon]],
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
