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



local models = asset.syncedResource({
  Name = "Bennu Models",
  Type = "HttpSynchronization",
  Identifier = "bennu_models",
  Version = 2
})


local BennuBodyId = "2101955"

local Bennu = {
  Identifier = "Bennu",
  Parent = transforms.BennuBarycenter.Identifier,
  Transform = {
    Rotation = {
      Type = "SpiceRotation",
      SourceFrame = "IAU_BENNU",
      DestinationFrame = "GALACTIC"
    }
  },
  Renderable = {
    Enabled = false,
    Type = "RenderableModel",
    Body = BennuBodyId,
    GeometryFile = models .. "Bennu_v20_200k_an.obj",
    LightSources = {
      sun.LightSource
    },
    SpecularIntensity = 0.0
  },
  GUI = {
    Path = "/Solar System/Asteroid"
  }
}


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

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

asset.export(Bennu)
