local transforms = asset.require("scene/solarsystem/planets/earth/transforms")



local omm = asset.syncedResource({
  Name = "Satellite OMM Data (100 Brightest)",
  Type = "UrlSynchronization",
  Identifier = "satellite_omm_data_visual",
  Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=visual&FORMAT=kvn",
  Filename = "visual.txt",
  Override = true
})


local BrightestSatellites = {
  Identifier = "BrightestSatellites",
  Parent = transforms.EarthInertial.Identifier,
  Renderable = {
    Type = "RenderableOrbitalKepler",
    Path = omm .. "visual.txt",
    Format = "OMM",
    SegmentQuality = 3,
    Color = { 0.55, 0.25, 0.65 },
    Fade = 1.5,
    RenderBinMode = "PostDeferredTransparent"
  },
  Tag = { "earth_satellites" },
  GUI = {
    Name = "100 Brightest",
    Path = "/Solar System/Planets/Earth/Satellites",
    Description = [[The 100 (or so) satellites that will appear brightest when viewed
      from Earth.]]
  }
}


asset.onInitialize(function()
  openspace.addSceneGraphNode(BrightestSatellites)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(BrightestSatellites)
end)

asset.export(BrightestSatellites)



asset.meta = {
  Name = "Satellites 100 Brightest",
  Version = "1.0",
  Description = "Satellites asset for 100 Brightest. Data from Celestrak",
  Author = "OpenSpace Team",
  URL = "https://celestrak.com/NORAD/elements/",
  License = "Celestrak"
}
