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



local Francisco = {
  Identifier = "Francisco",
  Parent = transforms.UranusBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "FRANCISCO",
      Observer = "URANUS BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 22000, 22000, 22000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_uranus",
    "moon_irregular_retrograde",
    "moon_minor",
    "moon_minor_uranus"
  },
  GUI = {
    Name = "Francisco",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Francisco"
  }
}

local FranciscoTrail = {
  Identifier = "FranciscoTrail",
  Parent = transforms.UranusBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "FRANCISCO",
      Observer = "URANUS BARYCENTER"
    },
    Color = { 0.60, 0.65, 0.84 },
    Period = 266.56,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_uranus",
    "moonTrail_minor",
    "moonTrail_minor_uranus"
  },
  GUI = {
    Name = "Francisco Trail",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Francisco"
  }
}

local FranciscoLabel = {
  Identifier = "FranciscoLabel",
  Parent = Francisco.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Francisco",
    FontSize = 70.0,
    Size = 7.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 2.0, 80.0 },
    FadeWidths = { 1.0, 40.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Francisco Label",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Francisco",
    Description = "Label for Uranus' moon Francisco (Irregular Retrograde Moons)"
  }
}

local Caliban = {
  Identifier = "Caliban",
  Parent = transforms.UranusBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "CALIBAN",
      Observer = "URANUS BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 72000, 72000, 72000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_uranus",
    "moon_irregular_retrograde",
    "moon_minor",
    "moon_minor_uranus"
  },
  GUI = {
    Name = "Caliban",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Caliban"
  }
}

local CalibanTrail = {
  Identifier = "CalibanTrail",
  Parent = transforms.UranusBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "CALIBAN",
      Observer = "URANUS BARYCENTER"
    },
    Color = { 0.60, 0.65, 0.84 },
    Period = 579.50,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_uranus",
    "moonTrail_minor",
    "moonTrail_minor_uranus"
  },
  GUI = {
    Name = "Caliban Trail",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Caliban"
  }
}

local CalibanLabel = {
  Identifier = "CalibanLabel",
  Parent = Caliban.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Caliban",
    FontSize = 70.0,
    Size = 7.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 2.0, 80.0 },
    FadeWidths = { 1.0, 40.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Caliban Label",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Caliban",
    Description = "Label for Uranus' moon Caliban (Irregular Retrograde Moons)"
  }
}

local Stephano = {
  Identifier = "Stephano",
  Parent = transforms.UranusBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "STEPHANO",
      Observer = "URANUS BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 32000, 32000, 32000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_uranus",
    "moon_irregular_retrograde",
    "moon_minor",
    "moon_minor_uranus"
  },
  GUI = {
    Name = "Stephano",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Stephano"
  }
}

local StephanoTrail = {
  Identifier = "StephanoTrail",
  Parent = transforms.UranusBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "STEPHANO",
      Observer = "URANUS BARYCENTER"
    },
    Color = { 0.60, 0.65, 0.84 },
    Period = 676.50,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_uranus",
    "moonTrail_minor",
    "moonTrail_minor_uranus"
  },
  GUI = {
    Name = "Stephano Trail",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Stephano"
  }
}

local StephanoLabel = {
  Identifier = "StephanoLabel",
  Parent = Stephano.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Stephano",
    FontSize = 70.0,
    Size = 7.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 2.0, 80.0 },
    FadeWidths = { 1.0, 40.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Stephano Label",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Stephano",
    Description = "Label for Uranus' moon Stephano (Irregular Retrograde Moons)"
  }
}

local Trinculo = {
  Identifier = "Trinculo",
  Parent = transforms.UranusBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "TRINCULO",
      Observer = "URANUS BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 18000, 18000, 18000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_uranus",
    "moon_irregular_retrograde",
    "moon_minor",
    "moon_minor_uranus"
  },
  GUI = {
    Name = "Trinculo",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Trinculo"
  }
}

local TrinculoTrail = {
  Identifier = "TrinculoTrail",
  Parent = transforms.UranusBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "TRINCULO",
      Observer = "URANUS BARYCENTER"
    },
    Color = { 0.60, 0.65, 0.84 },
    Period = 758.10,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_uranus",
    "moonTrail_minor",
    "moonTrail_minor_uranus"
  },
  GUI = {
    Name = "Trinculo Trail",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Trinculo"
  }
}

local TrinculoLabel = {
  Identifier = "TrinculoLabel",
  Parent = Trinculo.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Trinculo",
    FontSize = 70.0,
    Size = 7.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 2.0, 80.0 },
    FadeWidths = { 1.0, 40.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Trinculo Label",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Trinculo",
    Description = "Label for Uranus' moon Trinculo (Irregular Retrograde Moons)"
  }
}

local Sycorax = {
  Identifier = "Sycorax",
  Parent = transforms.UranusBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "SYCORAX",
      Observer = "URANUS BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 165000, 165000, 165000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_uranus",
    "moon_irregular_retrograde",
    "moon_minor",
    "moon_minor_uranus"
  },
  GUI = {
    Name = "Sycorax",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Sycorax"
  }
}

local SycoraxTrail = {
  Identifier = "SycoraxTrail",
  Parent = transforms.UranusBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "SYCORAX",
      Observer = "URANUS BARYCENTER"
    },
    Color = { 0.60, 0.65, 0.84 },
    Period = 1283.4,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_uranus",
    "moonTrail_minor",
    "moonTrail_minor_uranus"
  },
  GUI = {
    Name = "Sycorax Trail",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Sycorax"
  }
}

local SycoraxLabel = {
  Identifier = "SycoraxLabel",
  Parent = Sycorax.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Sycorax",
    FontSize = 70.0,
    Size = 7.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 2.0, 80.0 },
    FadeWidths = { 1.0, 40.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Sycorax Label",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Sycorax",
    Description = "Label for Uranus' moon Sycorax (Irregular Retrograde Moons)"
  }
}

local Prospero = {
  Identifier = "Prospero",
  Parent = transforms.UranusBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "PROSPERO",
      Observer = "URANUS BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 50000, 50000, 50000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_uranus",
    "moon_irregular_retrograde",
    "moon_minor",
    "moon_minor_uranus"
  },
  GUI = {
    Name = "Prospero",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Prospero"
  }
}

local ProsperoTrail = {
  Identifier = "ProsperoTrail",
  Parent = transforms.UranusBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "PROSPERO",
      Observer = "URANUS BARYCENTER"
    },
    Color = { 0.60, 0.65, 0.84 },
    Period = 1992.8,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_uranus",
    "moonTrail_minor",
    "moonTrail_minor_uranus"
  },
  GUI = {
    Name = "Prospero Trail",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Prospero"
  }
}

local ProsperoLabel = {
  Identifier = "ProsperoLabel",
  Parent = Prospero.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Prospero",
    FontSize = 70.0,
    Size = 7.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 2.0, 80.0 },
    FadeWidths = { 1.0, 40.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Prospero Label",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Prospero",
    Description = "Label for Uranus' moon Prospero (Irregular Retrograde Moons)"
  }
}

local Setebos = {
  Identifier = "Setebos",
  Parent = transforms.UranusBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "SETEBOS",
      Observer = "URANUS BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 48000, 48000, 48000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_uranus",
    "moon_irregular_retrograde",
    "moon_minor",
    "moon_minor_uranus"
  },
  GUI = {
    Name = "Setebos",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Setebos"
  }
}

local SetebosTrail = {
  Identifier = "SetebosTrail",
  Parent = transforms.UranusBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "SETEBOS",
      Observer = "URANUS BARYCENTER"
    },
    Color = { 0.60, 0.65, 0.84 },
    Period = 2202.3,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_uranus",
    "moonTrail_minor",
    "moonTrail_minor_uranus"
  },
  GUI = {
    Name = "Setebos Trail",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Setebos"
  }
}

local SetebosLabel = {
  Identifier = "SetebosLabel",
  Parent = Setebos.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Setebos",
    FontSize = 70.0,
    Size = 7.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 2.0, 80.0 },
    FadeWidths = { 1.0, 40.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Setebos Label",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Setebos",
    Description = "Label for Uranus' moon Setebos (Irregular Retrograde Moons)"
  }
}

local Ferdinand = {
  Identifier = "Ferdinand",
  Parent = transforms.UranusBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "FERDINAND",
      Observer = "URANUS BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 20000, 20000, 20000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_uranus",
    "moon_irregular_retrograde",
    "moon_minor",
    "moon_minor_uranus"
  },
  GUI = {
    Name = "Ferdinand",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Ferdinand"
  }
}

local FerdinandTrail = {
  Identifier = "FerdinandTrail",
  Parent = transforms.UranusBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "FERDINAND",
      Observer = "URANUS BARYCENTER"
    },
    Color = { 0.60, 0.65, 0.84 },
    Period = 2823.4,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_uranus",
    "moonTrail_minor",
    "moonTrail_minor_uranus"
  },
  GUI = {
    Name = "Ferdinand Trail",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Ferdinand"
  }
}

local FerdinandLabel = {
  Identifier = "FerdinandLabel",
  Parent = Ferdinand.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Ferdinand",
    FontSize = 70.0,
    Size = 7.0,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 2.0, 80.0 },
    FadeWidths = { 1.0, 40.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Ferdinand Label",
    Path = "/Solar System/Planets/Uranus/Minor Moons/Irregular Retrograde Moons/Ferdinand",
    Description = "Label for Uranus' moon Ferdinand (Irregular Retrograde Moons)"
  }
}


asset.onInitialize(function()
  openspace.spice.loadKernel(kernel.ura116)


  openspace.addSceneGraphNode(Francisco)
  openspace.addSceneGraphNode(FranciscoTrail)
  openspace.addSceneGraphNode(FranciscoLabel)

  openspace.addSceneGraphNode(Caliban)
  openspace.addSceneGraphNode(CalibanTrail)
  openspace.addSceneGraphNode(CalibanLabel)

  openspace.addSceneGraphNode(Stephano)
  openspace.addSceneGraphNode(StephanoTrail)
  openspace.addSceneGraphNode(StephanoLabel)

  openspace.addSceneGraphNode(Trinculo)
  openspace.addSceneGraphNode(TrinculoTrail)
  openspace.addSceneGraphNode(TrinculoLabel)

  openspace.addSceneGraphNode(Sycorax)
  openspace.addSceneGraphNode(SycoraxTrail)
  openspace.addSceneGraphNode(SycoraxLabel)

  openspace.addSceneGraphNode(Prospero)
  openspace.addSceneGraphNode(ProsperoTrail)
  openspace.addSceneGraphNode(ProsperoLabel)

  openspace.addSceneGraphNode(Setebos)
  openspace.addSceneGraphNode(SetebosTrail)
  openspace.addSceneGraphNode(SetebosLabel)

  openspace.addSceneGraphNode(Ferdinand)
  openspace.addSceneGraphNode(FerdinandTrail)
  openspace.addSceneGraphNode(FerdinandLabel)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(FerdinandLabel)
  openspace.removeSceneGraphNode(FerdinandTrail)
  openspace.removeSceneGraphNode(Ferdinand)

  openspace.removeSceneGraphNode(SetebosLabel)
  openspace.removeSceneGraphNode(SetebosTrail)
  openspace.removeSceneGraphNode(Setebos)

  openspace.removeSceneGraphNode(ProsperoLabel)
  openspace.removeSceneGraphNode(ProsperoTrail)
  openspace.removeSceneGraphNode(Prospero)

  openspace.removeSceneGraphNode(SycoraxLabel)
  openspace.removeSceneGraphNode(SycoraxTrail)
  openspace.removeSceneGraphNode(Sycorax)

  openspace.removeSceneGraphNode(TrinculoLabel)
  openspace.removeSceneGraphNode(TrinculoTrail)
  openspace.removeSceneGraphNode(Trinculo)

  openspace.removeSceneGraphNode(StephanoLabel)
  openspace.removeSceneGraphNode(StephanoTrail)
  openspace.removeSceneGraphNode(Stephano)

  openspace.removeSceneGraphNode(CalibanLabel)
  openspace.removeSceneGraphNode(CalibanTrail)
  openspace.removeSceneGraphNode(Caliban)

  openspace.removeSceneGraphNode(FranciscoLabel)
  openspace.removeSceneGraphNode(FranciscoTrail)
  openspace.removeSceneGraphNode(Francisco)


  openspace.spice.unloadKernel(kernel.ura116)
end)

asset.export(Francisco)
asset.export(FranciscoTrail)
asset.export(FranciscoLabel)

asset.export(Caliban)
asset.export(CalibanTrail)
asset.export(CalibanLabel)

asset.export(Stephano)
asset.export(StephanoTrail)
asset.export(StephanoLabel)

asset.export(Trinculo)
asset.export(TrinculoTrail)
asset.export(TrinculoLabel)

asset.export(Sycorax)
asset.export(SycoraxTrail)
asset.export(SycoraxLabel)

asset.export(Prospero)
asset.export(ProsperoTrail)
asset.export(ProsperoLabel)

asset.export(Setebos)
asset.export(SetebosTrail)
asset.export(SetebosLabel)

asset.export(Ferdinand)
asset.export(FerdinandTrail)
asset.export(FerdinandLabel)


asset.meta = {
  Name = "Uranus Irregular Retrograde Moons",
  Version = "1.0",
  Description = [[Procedural Globe asset containing Uranus' irregular retrograde moons:
    Francisco, Caliban, Stephano, Trinculo, Sycorax, Prospero, Setebos and Ferdinand.
    Blank globes and SPICE trails are generated for each moon]],
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
