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



local models = asset.syncedResource({
  Name = "Artemis Models",
  Type = "HttpSynchronization",
  Identifier = "artemis_1_models",
  Version = 1
})


local ArtemisModel = {
  Identifier = "ArtemisModel",
  Parent = transforms.ArtemisPosition.Identifier,
  ApproachFactor = 2700,
  Transform = {
    Rotation = {
      Type = "FixedRotation",
      Attached = "ArtemisModel",
      XAxis = { 1.0, 0.0, 0.0 },
      XAxisOrthogonal = true,
      YAxis = "Sun",
      YAxisInvert = true
    }
  },
  Renderable = {
    Type = "RenderableModel",
    GeometryFile = models .. "artemis.glb",
    LightSources = {
      sun.LightSource
    },
    AmbientIntensity = 0.05
  },
  GUI = {
    Name = "Orion (Artemis-1) Model",
    Path = "/Solar System/Missions/Artemis",
    Description = "Model of the Orion capsule for the Artemis-1 mission"
  }
}


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

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

asset.export(ArtemisModel)



asset.meta = {
  Name = "Artemis-1 Model",
  Version = "1.0",
  Description = "Orion capsule model for the Artemis-1 mission",
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
