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



local omm = asset.syncedResource({
  Name = "Satellite OMM Data (Tracking and Data Relay Satellite System (TDRSS))",
  Type = "UrlSynchronization",
  Identifier = "satellite_omm_data_tdrss",
  Url = "https://www.celestrak.com/NORAD/elements/gp.php?GROUP=tdrss&FORMAT=kvn",
  Filename = "tdrss.txt",
  Override = true
})


local TrackingDataRelaySatellites = {
  Identifier = "TrackingDataRelaySatellites",
  Parent = transforms.EarthInertial.Identifier,
  Renderable = {
    Type = "RenderableOrbitalKepler",
    Path = omm .. "tdrss.txt",
    Format = "OMM",
    SegmentQuality = 3,
    Color = { 0.75, 0.75, 0.35 },
    Fade = 1.5,
    RenderBinMode = "PostDeferredTransparent"
  },
  Tag = { "earth_satellites" },
  GUI = {
    Name = "Tracking and Data Relay Satellite System (TDRSS)",
    Path = "/Solar System/Planets/Earth/Satellites"
  }
}


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

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

asset.export(TrackingDataRelaySatellites)



asset.meta = {
  Name = "Satellites Weather - Tracking and Data Relay Satellite System (TDRSS)",
  Version = "1.0",
  Description = [[Satellites asset for Weather - Tracking and Data Relay Satellite
    System (TDRSS). Data from Celestrak]],
  Author = "OpenSpace Team",
  URL = "https://celestrak.com/NORAD/elements/",
  License = "Celestrak"
}
