local transforms = asset.require("../transforms")


local Styx = {
  Identifier = "Styx",
  Parent = transforms.PlutoBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "STYX",
      Observer = "PLUTO BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 45000, 45000, 45000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = { "moon_solarSystem", "moon_dwarf", "moon_pluto", "moon_minor" },
  GUI = {
    Path = "/Solar System/Dwarf Planets/Pluto/Moons/Styx"
  }
}

local StyxTrail = {
  Identifier = "StyxTrail",
  Parent = transforms.PlutoBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "STYX",
      Observer = "PLUTO BARYCENTER",
    },
    Color = { 0.00, 0.62, 1.00 },
    Period = 20.16155,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_dwarf",
    "moonTrail_pluto",
    "moonTrail_minor"
  },
  GUI = {
    Name = "Styx Trail",
    Path = "/Solar System/Dwarf Planets/Pluto/Moons/Styx"
  }
}

local StyxLabel = {
  Identifier = "StyxLabel",
  Parent = Styx.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Styx",
    FontSize = 70.0,
    Size = 6.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Normal",
    EnableFading = true,
    FadeUnit = "Mm",
    FadeDistances = { 250.0, 1000.0 },
    FadeWidths = { 150.0, 500.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Styx Label",
    Path = "/Solar System/Dwarf Planets/Pluto/Moons/Styx",
    Description = "Label for Pluto's moon Styx"
  }
}


asset.onInitialize(function()
  openspace.addSceneGraphNode(Styx)
  openspace.addSceneGraphNode(StyxTrail)
  openspace.addSceneGraphNode(StyxLabel)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(StyxLabel)
  openspace.removeSceneGraphNode(StyxTrail)
  openspace.removeSceneGraphNode(Styx)
end)

asset.export(Styx)
asset.export(StyxTrail)
asset.export(StyxLabel)



asset.meta = {
  Name = "Styx",
  Version = "1.0",
  Description = [[Globe and trail for Pluto's moon Styx. Data from NASA Spice (see base
    spice asset)]],
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
