mapSolarSystems.jsonl
Schema
_key
(required): integer
Range: 30000001 .. 36000001border
: booleanconstellationID
(required): integer
Range: 20000001 .. 26000001corridor
: booleandisallowedAnchorCategories
: array of integer
Type:integer
Range: 22 .. 65disallowedAnchorGroups
: array of integer
Type:integer
Range: 12 .. 448factionID
: integer
Range: 500001 .. 500029fringe
: booleanhub
: booleaninternational
: booleanluminosity
: number
Range: 0.01001 .. 18.57-
name
(required): objectde
(required): stringen
(required): stringes
(required): stringfr
(required): stringja
(required): stringko
(required): stringru
(required): stringzh
(required): string
-
planetIDs
: array of integer
Type:integer
Range: 40000002 .. 40488501 -
position
(required): objectx
(required): number
Range: -5563286233278308400 .. 8239096461438873600y
(required): number
Range: -69987536437191112 .. 6024297162052176900z
(required): number
Range: -10045474424930228000 .. 472860102256056640
-
radius
(required): number
Range: 260800000 .. 21286432538624 regionID
(required): integer
Range: 10000001 .. 19000001regional
: booleansecurityClass
: stringsecurityStatus
(required): number
Range: -1 .. 1starID
: integer
Range: 40000001 .. 40488503stargateIDs
: array of integer
Type:integer
Range: 50000001 .. 50016569visualEffect
: stringwormholeClassID
: integer
Range: 8 .. 18
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var mapSolarSystem = MapSolarSystem.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class MapSolarSystem
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("border", NullValueHandling = NullValueHandling.Ignore)]
public bool? Border { get; set; }
[JsonProperty("constellationID")]
public long ConstellationId { get; set; }
[JsonProperty("corridor", NullValueHandling = NullValueHandling.Ignore)]
public bool? Corridor { get; set; }
[JsonProperty("disallowedAnchorCategories", NullValueHandling = NullValueHandling.Ignore)]
public long[] DisallowedAnchorCategories { get; set; }
[JsonProperty("disallowedAnchorGroups", NullValueHandling = NullValueHandling.Ignore)]
public long[] DisallowedAnchorGroups { get; set; }
[JsonProperty("factionID", NullValueHandling = NullValueHandling.Ignore)]
public long? FactionId { get; set; }
[JsonProperty("fringe", NullValueHandling = NullValueHandling.Ignore)]
public bool? Fringe { get; set; }
[JsonProperty("hub", NullValueHandling = NullValueHandling.Ignore)]
public bool? Hub { get; set; }
[JsonProperty("international", NullValueHandling = NullValueHandling.Ignore)]
public bool? International { get; set; }
[JsonProperty("luminosity", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
public double? Luminosity { get; set; }
[JsonProperty("name")]
public Name Name { get; set; }
[JsonProperty("planetIDs", NullValueHandling = NullValueHandling.Ignore)]
public long[] PlanetIDs { get; set; }
[JsonProperty("position")]
public Position Position { get; set; }
[JsonProperty("radius")]
[JsonConverter(typeof(IndigoMinMaxValueCheckConverter))]
public double Radius { get; set; }
[JsonProperty("regional", NullValueHandling = NullValueHandling.Ignore)]
public bool? Regional { get; set; }
[JsonProperty("regionID")]
public long RegionId { get; set; }
[JsonProperty("securityClass", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
public string SecurityClass { get; set; }
[JsonProperty("securityStatus")]
[JsonConverter(typeof(IndecentMinMaxValueCheckConverter))]
public double SecurityStatus { get; set; }
[JsonProperty("stargateIDs", NullValueHandling = NullValueHandling.Ignore)]
public long[] StargateIDs { get; set; }
[JsonProperty("starID", NullValueHandling = NullValueHandling.Ignore)]
public long? StarId { get; set; }
[JsonProperty("visualEffect", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(HilariousMinMaxLengthCheckConverter))]
public string VisualEffect { get; set; }
[JsonProperty("wormholeClassID", NullValueHandling = NullValueHandling.Ignore)]
public long? WormholeClassId { get; set; }
}
public partial class Name
{
[JsonProperty("de")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja")]
[JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko")]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonProperty("ru")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonProperty("zh")]
[JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
public string Zh { get; set; }
}
public partial class Position
{
[JsonProperty("x")]
[JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
public double X { get; set; }
[JsonProperty("y")]
[JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
public double Y { get; set; }
[JsonProperty("z")]
[JsonConverter(typeof(StickyMinMaxValueCheckConverter))]
public double Z { get; set; }
}
public partial class MapSolarSystem
{
public static MapSolarSystem FromJson(string json) => JsonConvert.DeserializeObject<MapSolarSystem>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this MapSolarSystem self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
internal class PurpleMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 0.01001 && value <= 18.57)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 0.01001 && value <= 18.57)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly PurpleMinMaxValueCheckConverter Singleton = new PurpleMinMaxValueCheckConverter();
}
internal class PurpleMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 3 && value.Length <= 18)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 3 && value.Length <= 18)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly PurpleMinMaxLengthCheckConverter Singleton = new PurpleMinMaxLengthCheckConverter();
}
internal class FluffyMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 3 && value.Length <= 19)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 3 && value.Length <= 19)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FluffyMinMaxLengthCheckConverter Singleton = new FluffyMinMaxLengthCheckConverter();
}
internal class TentacledMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 2 && value.Length <= 14)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 2 && value.Length <= 14)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly TentacledMinMaxLengthCheckConverter Singleton = new TentacledMinMaxLengthCheckConverter();
}
internal class StickyMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 1 && value.Length <= 10)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 1 && value.Length <= 10)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly StickyMinMaxLengthCheckConverter Singleton = new StickyMinMaxLengthCheckConverter();
}
internal class IndigoMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 1 && value.Length <= 7)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 1 && value.Length <= 7)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndigoMinMaxLengthCheckConverter Singleton = new IndigoMinMaxLengthCheckConverter();
}
internal class FluffyMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= -5563286233278308000 && value <= 8239096461438874000)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= -5563286233278308000 && value <= 8239096461438874000)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly FluffyMinMaxValueCheckConverter Singleton = new FluffyMinMaxValueCheckConverter();
}
internal class TentacledMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= -69987536437191110 && value <= 6024297162052177000)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= -69987536437191110 && value <= 6024297162052177000)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly TentacledMinMaxValueCheckConverter Singleton = new TentacledMinMaxValueCheckConverter();
}
internal class StickyMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= -10045474424930228000 && value <= 472860102256056640)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= -10045474424930228000 && value <= 472860102256056640)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly StickyMinMaxValueCheckConverter Singleton = new StickyMinMaxValueCheckConverter();
}
internal class IndigoMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 260800000 && value <= 21286432538624)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 260800000 && value <= 21286432538624)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndigoMinMaxValueCheckConverter Singleton = new IndigoMinMaxValueCheckConverter();
}
internal class IndecentMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 1 && value.Length <= 2)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 1 && value.Length <= 2)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndecentMinMaxLengthCheckConverter Singleton = new IndecentMinMaxLengthCheckConverter();
}
internal class IndecentMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= -1 && value <= 1)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= -1 && value <= 1)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndecentMinMaxValueCheckConverter Singleton = new IndecentMinMaxValueCheckConverter();
}
internal class HilariousMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 5 && value.Length <= 25)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 5 && value.Length <= 25)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly HilariousMinMaxLengthCheckConverter Singleton = new HilariousMinMaxLengthCheckConverter();
}
}
// Code generated from JSON Schema using quicktype. DO NOT EDIT.
// To parse and unparse this JSON data, add this code to your project and do:
//
// mapSolarSystem, err := UnmarshalMapSolarSystem(bytes)
// bytes, err = mapSolarSystem.Marshal()
package model
import "encoding/json"
func UnmarshalMapSolarSystem(data []byte) (MapSolarSystem, error) {
var r MapSolarSystem
err := json.Unmarshal(data, &r)
return r, err
}
func (r *MapSolarSystem) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type MapSolarSystem struct {
Key int64 `json:"_key"`
Border *bool `json:"border,omitempty"`
ConstellationID int64 `json:"constellationID"`
Corridor *bool `json:"corridor,omitempty"`
DisallowedAnchorCategories []int64 `json:"disallowedAnchorCategories,omitempty"`
DisallowedAnchorGroups []int64 `json:"disallowedAnchorGroups,omitempty"`
FactionID *int64 `json:"factionID,omitempty"`
Fringe *bool `json:"fringe,omitempty"`
Hub *bool `json:"hub,omitempty"`
International *bool `json:"international,omitempty"`
Luminosity *float64 `json:"luminosity,omitempty"`
Name Name `json:"name"`
PlanetIDs []int64 `json:"planetIDs,omitempty"`
Position Position `json:"position"`
Radius float64 `json:"radius"`
Regional *bool `json:"regional,omitempty"`
RegionID int64 `json:"regionID"`
SecurityClass *string `json:"securityClass,omitempty"`
SecurityStatus float64 `json:"securityStatus"`
StargateIDs []int64 `json:"stargateIDs,omitempty"`
StarID *int64 `json:"starID,omitempty"`
VisualEffect *string `json:"visualEffect,omitempty"`
WormholeClassID *int64 `json:"wormholeClassID,omitempty"`
}
type Name struct {
De string `json:"de"`
En string `json:"en"`
Es string `json:"es"`
Fr string `json:"fr"`
Ja string `json:"ja"`
Ko string `json:"ko"`
Ru string `json:"ru"`
Zh string `json:"zh"`
}
type Position struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Z float64 `json:"z"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 30000001,
"maximum": 36000001
},
"border": {
"type": "boolean"
},
"constellationID": {
"type": "integer",
"minimum": 20000001,
"maximum": 26000001
},
"corridor": {
"type": "boolean"
},
"disallowedAnchorCategories": {
"type": "array",
"items": {
"type": "integer",
"minimum": 22,
"maximum": 65
},
"minItems": 1,
"maxItems": 2
},
"disallowedAnchorGroups": {
"type": "array",
"items": {
"type": "integer",
"minimum": 12,
"maximum": 448
},
"minItems": 1,
"maxItems": 3
},
"factionID": {
"type": "integer",
"minimum": 500001,
"maximum": 500029
},
"fringe": {
"type": "boolean"
},
"hub": {
"type": "boolean"
},
"international": {
"type": "boolean"
},
"luminosity": {
"type": "number",
"minimum": 0.01001,
"maximum": 18.57
},
"name": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 3,
"maxLength": 18
},
"en": {
"type": "string",
"minLength": 3,
"maxLength": 18
},
"es": {
"type": "string",
"minLength": 3,
"maxLength": 19
},
"fr": {
"type": "string",
"minLength": 3,
"maxLength": 18
},
"ja": {
"type": "string",
"minLength": 2,
"maxLength": 14
},
"ko": {
"type": "string",
"minLength": 1,
"maxLength": 10
},
"ru": {
"type": "string",
"minLength": 3,
"maxLength": 18
},
"zh": {
"type": "string",
"minLength": 1,
"maxLength": 7
}
},
"required": [
"de",
"en",
"es",
"fr",
"ja",
"ko",
"ru",
"zh"
]
},
"planetIDs": {
"type": "array",
"items": {
"type": "integer",
"minimum": 40000002,
"maximum": 40488501
},
"minItems": 1,
"maxItems": 18
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -5.5632862332783084E18,
"maximum": 8.2390964614388736E18
},
"y": {
"type": "number",
"minimum": -6.9987536437191112E16,
"maximum": 6.0242971620521769E18
},
"z": {
"type": "number",
"minimum": -1.0045474424930228E19,
"maximum": 4.7286010225605664E17
}
},
"required": [
"x",
"y",
"z"
]
},
"radius": {
"type": "number",
"minimum": 2.608E8,
"maximum": 2.1286432538624E13
},
"regionID": {
"type": "integer",
"minimum": 10000001,
"maximum": 19000001
},
"regional": {
"type": "boolean"
},
"securityClass": {
"type": "string",
"minLength": 1,
"maxLength": 2
},
"securityStatus": {
"type": "number",
"minimum": -1.0,
"maximum": 1.0
},
"starID": {
"type": "integer",
"minimum": 40000001,
"maximum": 40488503
},
"stargateIDs": {
"type": "array",
"items": {
"type": "integer",
"minimum": 50000001,
"maximum": 50016569
},
"minItems": 1,
"maxItems": 8
},
"visualEffect": {
"type": "string",
"minLength": 5,
"maxLength": 25
},
"wormholeClassID": {
"type": "integer",
"minimum": 8,
"maximum": 18
}
},
"required": [
"_key",
"constellationID",
"name",
"position",
"radius",
"regionID",
"securityStatus"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val mapSolarSystem = json.parse(MapSolarSystem.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class MapSolarSystem (
@SerialName("_key")
val key: Long,
val border: Boolean? = null,
@SerialName("constellationID")
val constellationId: Long,
val corridor: Boolean? = null,
val disallowedAnchorCategories: List<Long>? = null,
val disallowedAnchorGroups: List<Long>? = null,
@SerialName("factionID")
val factionId: Long? = null,
val fringe: Boolean? = null,
val hub: Boolean? = null,
val international: Boolean? = null,
val luminosity: Double? = null,
val name: Name,
val planetIDs: List<Long>? = null,
val position: Position,
val radius: Double,
val regional: Boolean? = null,
@SerialName("regionID")
val regionId: Long,
val securityClass: String? = null,
val securityStatus: Double,
val stargateIDs: List<Long>? = null,
@SerialName("starID")
val starId: Long? = null,
val visualEffect: String? = null,
@SerialName("wormholeClassID")
val wormholeClassId: Long? = null
)
@Serializable
data class Name (
val de: String,
val en: String,
val es: String,
val fr: String,
val ja: String,
val ko: String,
val ru: String,
val zh: String
)
@Serializable
data class Position (
val x: Double,
val y: Double,
val z: Double
)
<?php
// This is a autogenerated file:MapSolarSystem
class MapSolarSystem {
private int $key; // json:_key Required
private ?bool $border; // json:border Optional
private int $constellationId; // json:constellationID Required
private ?bool $corridor; // json:corridor Optional
private ?array $disallowedAnchorCategories; // json:disallowedAnchorCategories Optional
private ?array $disallowedAnchorGroups; // json:disallowedAnchorGroups Optional
private ?int $factionId; // json:factionID Optional
private ?bool $fringe; // json:fringe Optional
private ?bool $hub; // json:hub Optional
private ?bool $international; // json:international Optional
private ?float $luminosity; // json:luminosity Optional
private Name $name; // json:name Required
private ?array $planetIDs; // json:planetIDs Optional
private Position $position; // json:position Required
private float $radius; // json:radius Required
private ?bool $regional; // json:regional Optional
private int $regionId; // json:regionID Required
private ?string $securityClass; // json:securityClass Optional
private float $securityStatus; // json:securityStatus Required
private ?array $stargateIDs; // json:stargateIDs Optional
private ?int $starId; // json:starID Optional
private ?string $visualEffect; // json:visualEffect Optional
private ?int $wormholeClassId; // json:wormholeClassID Optional
/**
* @param int $key
* @param bool|null $border
* @param int $constellationId
* @param bool|null $corridor
* @param array|null $disallowedAnchorCategories
* @param array|null $disallowedAnchorGroups
* @param int|null $factionId
* @param bool|null $fringe
* @param bool|null $hub
* @param bool|null $international
* @param float|null $luminosity
* @param Name $name
* @param array|null $planetIDs
* @param Position $position
* @param float $radius
* @param bool|null $regional
* @param int $regionId
* @param string|null $securityClass
* @param float $securityStatus
* @param array|null $stargateIDs
* @param int|null $starId
* @param string|null $visualEffect
* @param int|null $wormholeClassId
*/
public function __construct(int $key, ?bool $border, int $constellationId, ?bool $corridor, ?array $disallowedAnchorCategories, ?array $disallowedAnchorGroups, ?int $factionId, ?bool $fringe, ?bool $hub, ?bool $international, ?float $luminosity, Name $name, ?array $planetIDs, Position $position, float $radius, ?bool $regional, int $regionId, ?string $securityClass, float $securityStatus, ?array $stargateIDs, ?int $starId, ?string $visualEffect, ?int $wormholeClassId) {
$this->key = $key;
$this->border = $border;
$this->constellationId = $constellationId;
$this->corridor = $corridor;
$this->disallowedAnchorCategories = $disallowedAnchorCategories;
$this->disallowedAnchorGroups = $disallowedAnchorGroups;
$this->factionId = $factionId;
$this->fringe = $fringe;
$this->hub = $hub;
$this->international = $international;
$this->luminosity = $luminosity;
$this->name = $name;
$this->planetIDs = $planetIDs;
$this->position = $position;
$this->radius = $radius;
$this->regional = $regional;
$this->regionId = $regionId;
$this->securityClass = $securityClass;
$this->securityStatus = $securityStatus;
$this->stargateIDs = $stargateIDs;
$this->starId = $starId;
$this->visualEffect = $visualEffect;
$this->wormholeClassId = $wormholeClassId;
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromKey(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toKey(): int {
if (MapSolarSystem::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this MapSolarSystem::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapSolarSystem::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (MapSolarSystem::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey MapSolarSystem::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param ?bool $value
* @throws Exception
* @return ?bool
*/
public static function fromBorder(?bool $value): ?bool {
if (!is_null($value)) {
return $value; /*bool*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?bool
*/
public function toBorder(): ?bool {
if (MapSolarSystem::validateBorder($this->border)) {
if (!is_null($this->border)) {
return $this->border; /*bool*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::border');
}
/**
* @param bool|null
* @return bool
* @throws Exception
*/
public static function validateBorder(?bool $value): bool {
if (!is_null($value)) {
if (!is_bool($value)) {
throw new Exception("Attribute Error:MapSolarSystem::border");
}
}
return true;
}
/**
* @throws Exception
* @return ?bool
*/
public function getBorder(): ?bool {
if (MapSolarSystem::validateBorder($this->border)) {
return $this->border;
}
throw new Exception('never get to getBorder MapSolarSystem::border');
}
/**
* @return ?bool
*/
public static function sampleBorder(): ?bool {
return true; /*32:border*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromConstellationId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toConstellationId(): int {
if (MapSolarSystem::validateConstellationId($this->constellationId)) {
return $this->constellationId; /*int*/
}
throw new Exception('never get to this MapSolarSystem::constellationId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateConstellationId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapSolarSystem::constellationId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getConstellationId(): int {
if (MapSolarSystem::validateConstellationId($this->constellationId)) {
return $this->constellationId;
}
throw new Exception('never get to getConstellationId MapSolarSystem::constellationId');
}
/**
* @return int
*/
public static function sampleConstellationId(): int {
return 33; /*33:constellationId*/
}
/**
* @param ?bool $value
* @throws Exception
* @return ?bool
*/
public static function fromCorridor(?bool $value): ?bool {
if (!is_null($value)) {
return $value; /*bool*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?bool
*/
public function toCorridor(): ?bool {
if (MapSolarSystem::validateCorridor($this->corridor)) {
if (!is_null($this->corridor)) {
return $this->corridor; /*bool*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::corridor');
}
/**
* @param bool|null
* @return bool
* @throws Exception
*/
public static function validateCorridor(?bool $value): bool {
if (!is_null($value)) {
if (!is_bool($value)) {
throw new Exception("Attribute Error:MapSolarSystem::corridor");
}
}
return true;
}
/**
* @throws Exception
* @return ?bool
*/
public function getCorridor(): ?bool {
if (MapSolarSystem::validateCorridor($this->corridor)) {
return $this->corridor;
}
throw new Exception('never get to getCorridor MapSolarSystem::corridor');
}
/**
* @return ?bool
*/
public static function sampleCorridor(): ?bool {
return true; /*34:corridor*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromDisallowedAnchorCategories(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return $value; /*int*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toDisallowedAnchorCategories(): ?array {
if (MapSolarSystem::validateDisallowedAnchorCategories($this->disallowedAnchorCategories)) {
if (!is_null($this->disallowedAnchorCategories)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->disallowedAnchorCategories);
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::disallowedAnchorCategories');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateDisallowedAnchorCategories(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:MapSolarSystem::disallowedAnchorCategories");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:MapSolarSystem::disallowedAnchorCategories");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getDisallowedAnchorCategories(): ?array {
if (MapSolarSystem::validateDisallowedAnchorCategories($this->disallowedAnchorCategories)) {
return $this->disallowedAnchorCategories;
}
throw new Exception('never get to getDisallowedAnchorCategories MapSolarSystem::disallowedAnchorCategories');
}
/**
* @return ?array
*/
public static function sampleDisallowedAnchorCategories(): ?array {
return array(
35 /*35:*/
); /* 35:disallowedAnchorCategories*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromDisallowedAnchorGroups(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return $value; /*int*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toDisallowedAnchorGroups(): ?array {
if (MapSolarSystem::validateDisallowedAnchorGroups($this->disallowedAnchorGroups)) {
if (!is_null($this->disallowedAnchorGroups)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->disallowedAnchorGroups);
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::disallowedAnchorGroups');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateDisallowedAnchorGroups(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:MapSolarSystem::disallowedAnchorGroups");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:MapSolarSystem::disallowedAnchorGroups");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getDisallowedAnchorGroups(): ?array {
if (MapSolarSystem::validateDisallowedAnchorGroups($this->disallowedAnchorGroups)) {
return $this->disallowedAnchorGroups;
}
throw new Exception('never get to getDisallowedAnchorGroups MapSolarSystem::disallowedAnchorGroups');
}
/**
* @return ?array
*/
public static function sampleDisallowedAnchorGroups(): ?array {
return array(
36 /*36:*/
); /* 36:disallowedAnchorGroups*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromFactionId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toFactionId(): ?int {
if (MapSolarSystem::validateFactionId($this->factionId)) {
if (!is_null($this->factionId)) {
return $this->factionId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::factionId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateFactionId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapSolarSystem::factionId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getFactionId(): ?int {
if (MapSolarSystem::validateFactionId($this->factionId)) {
return $this->factionId;
}
throw new Exception('never get to getFactionId MapSolarSystem::factionId');
}
/**
* @return ?int
*/
public static function sampleFactionId(): ?int {
return 37; /*37:factionId*/
}
/**
* @param ?bool $value
* @throws Exception
* @return ?bool
*/
public static function fromFringe(?bool $value): ?bool {
if (!is_null($value)) {
return $value; /*bool*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?bool
*/
public function toFringe(): ?bool {
if (MapSolarSystem::validateFringe($this->fringe)) {
if (!is_null($this->fringe)) {
return $this->fringe; /*bool*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::fringe');
}
/**
* @param bool|null
* @return bool
* @throws Exception
*/
public static function validateFringe(?bool $value): bool {
if (!is_null($value)) {
if (!is_bool($value)) {
throw new Exception("Attribute Error:MapSolarSystem::fringe");
}
}
return true;
}
/**
* @throws Exception
* @return ?bool
*/
public function getFringe(): ?bool {
if (MapSolarSystem::validateFringe($this->fringe)) {
return $this->fringe;
}
throw new Exception('never get to getFringe MapSolarSystem::fringe');
}
/**
* @return ?bool
*/
public static function sampleFringe(): ?bool {
return true; /*38:fringe*/
}
/**
* @param ?bool $value
* @throws Exception
* @return ?bool
*/
public static function fromHub(?bool $value): ?bool {
if (!is_null($value)) {
return $value; /*bool*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?bool
*/
public function toHub(): ?bool {
if (MapSolarSystem::validateHub($this->hub)) {
if (!is_null($this->hub)) {
return $this->hub; /*bool*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::hub');
}
/**
* @param bool|null
* @return bool
* @throws Exception
*/
public static function validateHub(?bool $value): bool {
if (!is_null($value)) {
if (!is_bool($value)) {
throw new Exception("Attribute Error:MapSolarSystem::hub");
}
}
return true;
}
/**
* @throws Exception
* @return ?bool
*/
public function getHub(): ?bool {
if (MapSolarSystem::validateHub($this->hub)) {
return $this->hub;
}
throw new Exception('never get to getHub MapSolarSystem::hub');
}
/**
* @return ?bool
*/
public static function sampleHub(): ?bool {
return true; /*39:hub*/
}
/**
* @param ?bool $value
* @throws Exception
* @return ?bool
*/
public static function fromInternational(?bool $value): ?bool {
if (!is_null($value)) {
return $value; /*bool*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?bool
*/
public function toInternational(): ?bool {
if (MapSolarSystem::validateInternational($this->international)) {
if (!is_null($this->international)) {
return $this->international; /*bool*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::international');
}
/**
* @param bool|null
* @return bool
* @throws Exception
*/
public static function validateInternational(?bool $value): bool {
if (!is_null($value)) {
if (!is_bool($value)) {
throw new Exception("Attribute Error:MapSolarSystem::international");
}
}
return true;
}
/**
* @throws Exception
* @return ?bool
*/
public function getInternational(): ?bool {
if (MapSolarSystem::validateInternational($this->international)) {
return $this->international;
}
throw new Exception('never get to getInternational MapSolarSystem::international');
}
/**
* @return ?bool
*/
public static function sampleInternational(): ?bool {
return true; /*40:international*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromLuminosity(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toLuminosity(): ?float {
if (MapSolarSystem::validateLuminosity($this->luminosity)) {
if (!is_null($this->luminosity)) {
return $this->luminosity; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::luminosity');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateLuminosity(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:MapSolarSystem::luminosity");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getLuminosity(): ?float {
if (MapSolarSystem::validateLuminosity($this->luminosity)) {
return $this->luminosity;
}
throw new Exception('never get to getLuminosity MapSolarSystem::luminosity');
}
/**
* @return ?float
*/
public static function sampleLuminosity(): ?float {
return 41.041; /*41:luminosity*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Name
*/
public static function fromName(stdClass $value): Name {
return Name::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toName(): stdClass {
if (MapSolarSystem::validateName($this->name)) {
return $this->name->to(); /*class*/
}
throw new Exception('never get to this MapSolarSystem::name');
}
/**
* @param Name
* @return bool
* @throws Exception
*/
public static function validateName(Name $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Name
*/
public function getName(): Name {
if (MapSolarSystem::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName MapSolarSystem::name');
}
/**
* @return Name
*/
public static function sampleName(): Name {
return Name::sample(); /*42:name*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromPlanetIDs(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return $value; /*int*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toPlanetIDs(): ?array {
if (MapSolarSystem::validatePlanetIDs($this->planetIDs)) {
if (!is_null($this->planetIDs)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->planetIDs);
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::planetIDs');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validatePlanetIDs(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:MapSolarSystem::planetIDs");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:MapSolarSystem::planetIDs");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getPlanetIDs(): ?array {
if (MapSolarSystem::validatePlanetIDs($this->planetIDs)) {
return $this->planetIDs;
}
throw new Exception('never get to getPlanetIDs MapSolarSystem::planetIDs');
}
/**
* @return ?array
*/
public static function samplePlanetIDs(): ?array {
return array(
43 /*43:*/
); /* 43:planetIDs*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Position
*/
public static function fromPosition(stdClass $value): Position {
return Position::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toPosition(): stdClass {
if (MapSolarSystem::validatePosition($this->position)) {
return $this->position->to(); /*class*/
}
throw new Exception('never get to this MapSolarSystem::position');
}
/**
* @param Position
* @return bool
* @throws Exception
*/
public static function validatePosition(Position $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Position
*/
public function getPosition(): Position {
if (MapSolarSystem::validatePosition($this->position)) {
return $this->position;
}
throw new Exception('never get to getPosition MapSolarSystem::position');
}
/**
* @return Position
*/
public static function samplePosition(): Position {
return Position::sample(); /*44:position*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromRadius(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toRadius(): float {
if (MapSolarSystem::validateRadius($this->radius)) {
return $this->radius; /*float*/
}
throw new Exception('never get to this MapSolarSystem::radius');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateRadius(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:MapSolarSystem::radius");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getRadius(): float {
if (MapSolarSystem::validateRadius($this->radius)) {
return $this->radius;
}
throw new Exception('never get to getRadius MapSolarSystem::radius');
}
/**
* @return float
*/
public static function sampleRadius(): float {
return 45.045; /*45:radius*/
}
/**
* @param ?bool $value
* @throws Exception
* @return ?bool
*/
public static function fromRegional(?bool $value): ?bool {
if (!is_null($value)) {
return $value; /*bool*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?bool
*/
public function toRegional(): ?bool {
if (MapSolarSystem::validateRegional($this->regional)) {
if (!is_null($this->regional)) {
return $this->regional; /*bool*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::regional');
}
/**
* @param bool|null
* @return bool
* @throws Exception
*/
public static function validateRegional(?bool $value): bool {
if (!is_null($value)) {
if (!is_bool($value)) {
throw new Exception("Attribute Error:MapSolarSystem::regional");
}
}
return true;
}
/**
* @throws Exception
* @return ?bool
*/
public function getRegional(): ?bool {
if (MapSolarSystem::validateRegional($this->regional)) {
return $this->regional;
}
throw new Exception('never get to getRegional MapSolarSystem::regional');
}
/**
* @return ?bool
*/
public static function sampleRegional(): ?bool {
return true; /*46:regional*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromRegionId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toRegionId(): int {
if (MapSolarSystem::validateRegionId($this->regionId)) {
return $this->regionId; /*int*/
}
throw new Exception('never get to this MapSolarSystem::regionId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateRegionId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapSolarSystem::regionId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getRegionId(): int {
if (MapSolarSystem::validateRegionId($this->regionId)) {
return $this->regionId;
}
throw new Exception('never get to getRegionId MapSolarSystem::regionId');
}
/**
* @return int
*/
public static function sampleRegionId(): int {
return 47; /*47:regionId*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromSecurityClass(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toSecurityClass(): ?string {
if (MapSolarSystem::validateSecurityClass($this->securityClass)) {
if (!is_null($this->securityClass)) {
return $this->securityClass; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::securityClass');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateSecurityClass(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:MapSolarSystem::securityClass");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getSecurityClass(): ?string {
if (MapSolarSystem::validateSecurityClass($this->securityClass)) {
return $this->securityClass;
}
throw new Exception('never get to getSecurityClass MapSolarSystem::securityClass');
}
/**
* @return ?string
*/
public static function sampleSecurityClass(): ?string {
return 'MapSolarSystem::securityClass::48'; /*48:securityClass*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromSecurityStatus(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toSecurityStatus(): float {
if (MapSolarSystem::validateSecurityStatus($this->securityStatus)) {
return $this->securityStatus; /*float*/
}
throw new Exception('never get to this MapSolarSystem::securityStatus');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateSecurityStatus(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:MapSolarSystem::securityStatus");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getSecurityStatus(): float {
if (MapSolarSystem::validateSecurityStatus($this->securityStatus)) {
return $this->securityStatus;
}
throw new Exception('never get to getSecurityStatus MapSolarSystem::securityStatus');
}
/**
* @return float
*/
public static function sampleSecurityStatus(): float {
return 49.049; /*49:securityStatus*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromStargateIDs(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return $value; /*int*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toStargateIDs(): ?array {
if (MapSolarSystem::validateStargateIDs($this->stargateIDs)) {
if (!is_null($this->stargateIDs)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->stargateIDs);
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::stargateIDs');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateStargateIDs(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:MapSolarSystem::stargateIDs");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:MapSolarSystem::stargateIDs");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getStargateIDs(): ?array {
if (MapSolarSystem::validateStargateIDs($this->stargateIDs)) {
return $this->stargateIDs;
}
throw new Exception('never get to getStargateIDs MapSolarSystem::stargateIDs');
}
/**
* @return ?array
*/
public static function sampleStargateIDs(): ?array {
return array(
50 /*50:*/
); /* 50:stargateIDs*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromStarId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toStarId(): ?int {
if (MapSolarSystem::validateStarId($this->starId)) {
if (!is_null($this->starId)) {
return $this->starId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::starId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateStarId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapSolarSystem::starId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getStarId(): ?int {
if (MapSolarSystem::validateStarId($this->starId)) {
return $this->starId;
}
throw new Exception('never get to getStarId MapSolarSystem::starId');
}
/**
* @return ?int
*/
public static function sampleStarId(): ?int {
return 51; /*51:starId*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromVisualEffect(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toVisualEffect(): ?string {
if (MapSolarSystem::validateVisualEffect($this->visualEffect)) {
if (!is_null($this->visualEffect)) {
return $this->visualEffect; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::visualEffect');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateVisualEffect(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:MapSolarSystem::visualEffect");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getVisualEffect(): ?string {
if (MapSolarSystem::validateVisualEffect($this->visualEffect)) {
return $this->visualEffect;
}
throw new Exception('never get to getVisualEffect MapSolarSystem::visualEffect');
}
/**
* @return ?string
*/
public static function sampleVisualEffect(): ?string {
return 'MapSolarSystem::visualEffect::52'; /*52:visualEffect*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromWormholeClassId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toWormholeClassId(): ?int {
if (MapSolarSystem::validateWormholeClassId($this->wormholeClassId)) {
if (!is_null($this->wormholeClassId)) {
return $this->wormholeClassId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this MapSolarSystem::wormholeClassId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateWormholeClassId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapSolarSystem::wormholeClassId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getWormholeClassId(): ?int {
if (MapSolarSystem::validateWormholeClassId($this->wormholeClassId)) {
return $this->wormholeClassId;
}
throw new Exception('never get to getWormholeClassId MapSolarSystem::wormholeClassId');
}
/**
* @return ?int
*/
public static function sampleWormholeClassId(): ?int {
return 53; /*53:wormholeClassId*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return MapSolarSystem::validateKey($this->key)
|| MapSolarSystem::validateBorder($this->border)
|| MapSolarSystem::validateConstellationId($this->constellationId)
|| MapSolarSystem::validateCorridor($this->corridor)
|| MapSolarSystem::validateDisallowedAnchorCategories($this->disallowedAnchorCategories)
|| MapSolarSystem::validateDisallowedAnchorGroups($this->disallowedAnchorGroups)
|| MapSolarSystem::validateFactionId($this->factionId)
|| MapSolarSystem::validateFringe($this->fringe)
|| MapSolarSystem::validateHub($this->hub)
|| MapSolarSystem::validateInternational($this->international)
|| MapSolarSystem::validateLuminosity($this->luminosity)
|| MapSolarSystem::validateName($this->name)
|| MapSolarSystem::validatePlanetIDs($this->planetIDs)
|| MapSolarSystem::validatePosition($this->position)
|| MapSolarSystem::validateRadius($this->radius)
|| MapSolarSystem::validateRegional($this->regional)
|| MapSolarSystem::validateRegionId($this->regionId)
|| MapSolarSystem::validateSecurityClass($this->securityClass)
|| MapSolarSystem::validateSecurityStatus($this->securityStatus)
|| MapSolarSystem::validateStargateIDs($this->stargateIDs)
|| MapSolarSystem::validateStarId($this->starId)
|| MapSolarSystem::validateVisualEffect($this->visualEffect)
|| MapSolarSystem::validateWormholeClassId($this->wormholeClassId);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'border'} = $this->toBorder();
$out->{'constellationID'} = $this->toConstellationId();
$out->{'corridor'} = $this->toCorridor();
$out->{'disallowedAnchorCategories'} = $this->toDisallowedAnchorCategories();
$out->{'disallowedAnchorGroups'} = $this->toDisallowedAnchorGroups();
$out->{'factionID'} = $this->toFactionId();
$out->{'fringe'} = $this->toFringe();
$out->{'hub'} = $this->toHub();
$out->{'international'} = $this->toInternational();
$out->{'luminosity'} = $this->toLuminosity();
$out->{'name'} = $this->toName();
$out->{'planetIDs'} = $this->toPlanetIDs();
$out->{'position'} = $this->toPosition();
$out->{'radius'} = $this->toRadius();
$out->{'regional'} = $this->toRegional();
$out->{'regionID'} = $this->toRegionId();
$out->{'securityClass'} = $this->toSecurityClass();
$out->{'securityStatus'} = $this->toSecurityStatus();
$out->{'stargateIDs'} = $this->toStargateIDs();
$out->{'starID'} = $this->toStarId();
$out->{'visualEffect'} = $this->toVisualEffect();
$out->{'wormholeClassID'} = $this->toWormholeClassId();
return $out;
}
/**
* @param stdClass $obj
* @return MapSolarSystem
* @throws Exception
*/
public static function from(stdClass $obj): MapSolarSystem {
return new MapSolarSystem(
MapSolarSystem::fromKey($obj->{'_key'})
,MapSolarSystem::fromBorder($obj->{'border'})
,MapSolarSystem::fromConstellationId($obj->{'constellationID'})
,MapSolarSystem::fromCorridor($obj->{'corridor'})
,MapSolarSystem::fromDisallowedAnchorCategories($obj->{'disallowedAnchorCategories'})
,MapSolarSystem::fromDisallowedAnchorGroups($obj->{'disallowedAnchorGroups'})
,MapSolarSystem::fromFactionId($obj->{'factionID'})
,MapSolarSystem::fromFringe($obj->{'fringe'})
,MapSolarSystem::fromHub($obj->{'hub'})
,MapSolarSystem::fromInternational($obj->{'international'})
,MapSolarSystem::fromLuminosity($obj->{'luminosity'})
,MapSolarSystem::fromName($obj->{'name'})
,MapSolarSystem::fromPlanetIDs($obj->{'planetIDs'})
,MapSolarSystem::fromPosition($obj->{'position'})
,MapSolarSystem::fromRadius($obj->{'radius'})
,MapSolarSystem::fromRegional($obj->{'regional'})
,MapSolarSystem::fromRegionId($obj->{'regionID'})
,MapSolarSystem::fromSecurityClass($obj->{'securityClass'})
,MapSolarSystem::fromSecurityStatus($obj->{'securityStatus'})
,MapSolarSystem::fromStargateIDs($obj->{'stargateIDs'})
,MapSolarSystem::fromStarId($obj->{'starID'})
,MapSolarSystem::fromVisualEffect($obj->{'visualEffect'})
,MapSolarSystem::fromWormholeClassId($obj->{'wormholeClassID'})
);
}
/**
* @return MapSolarSystem
*/
public static function sample(): MapSolarSystem {
return new MapSolarSystem(
MapSolarSystem::sampleKey()
,MapSolarSystem::sampleBorder()
,MapSolarSystem::sampleConstellationId()
,MapSolarSystem::sampleCorridor()
,MapSolarSystem::sampleDisallowedAnchorCategories()
,MapSolarSystem::sampleDisallowedAnchorGroups()
,MapSolarSystem::sampleFactionId()
,MapSolarSystem::sampleFringe()
,MapSolarSystem::sampleHub()
,MapSolarSystem::sampleInternational()
,MapSolarSystem::sampleLuminosity()
,MapSolarSystem::sampleName()
,MapSolarSystem::samplePlanetIDs()
,MapSolarSystem::samplePosition()
,MapSolarSystem::sampleRadius()
,MapSolarSystem::sampleRegional()
,MapSolarSystem::sampleRegionId()
,MapSolarSystem::sampleSecurityClass()
,MapSolarSystem::sampleSecurityStatus()
,MapSolarSystem::sampleStargateIDs()
,MapSolarSystem::sampleStarId()
,MapSolarSystem::sampleVisualEffect()
,MapSolarSystem::sampleWormholeClassId()
);
}
}
// This is a autogenerated file:Name
class Name {
private string $de; // json:de Required
private string $en; // json:en Required
private string $es; // json:es Required
private string $fr; // json:fr Required
private string $ja; // json:ja Required
private string $ko; // json:ko Required
private string $ru; // json:ru Required
private string $zh; // json:zh Required
/**
* @param string $de
* @param string $en
* @param string $es
* @param string $fr
* @param string $ja
* @param string $ko
* @param string $ru
* @param string $zh
*/
public function __construct(string $de, string $en, string $es, string $fr, string $ja, string $ko, string $ru, string $zh) {
$this->de = $de;
$this->en = $en;
$this->es = $es;
$this->fr = $fr;
$this->ja = $ja;
$this->ko = $ko;
$this->ru = $ru;
$this->zh = $zh;
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromDe(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toDe(): string {
if (Name::validateDe($this->de)) {
return $this->de; /*string*/
}
throw new Exception('never get to this Name::de');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateDe(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::de");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getDe(): string {
if (Name::validateDe($this->de)) {
return $this->de;
}
throw new Exception('never get to getDe Name::de');
}
/**
* @return string
*/
public static function sampleDe(): string {
return 'Name::de::31'; /*31:de*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromEn(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toEn(): string {
if (Name::validateEn($this->en)) {
return $this->en; /*string*/
}
throw new Exception('never get to this Name::en');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEn(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::en");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEn(): string {
if (Name::validateEn($this->en)) {
return $this->en;
}
throw new Exception('never get to getEn Name::en');
}
/**
* @return string
*/
public static function sampleEn(): string {
return 'Name::en::32'; /*32:en*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromEs(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toEs(): string {
if (Name::validateEs($this->es)) {
return $this->es; /*string*/
}
throw new Exception('never get to this Name::es');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEs(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::es");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEs(): string {
if (Name::validateEs($this->es)) {
return $this->es;
}
throw new Exception('never get to getEs Name::es');
}
/**
* @return string
*/
public static function sampleEs(): string {
return 'Name::es::33'; /*33:es*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromFr(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toFr(): string {
if (Name::validateFr($this->fr)) {
return $this->fr; /*string*/
}
throw new Exception('never get to this Name::fr');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateFr(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::fr");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getFr(): string {
if (Name::validateFr($this->fr)) {
return $this->fr;
}
throw new Exception('never get to getFr Name::fr');
}
/**
* @return string
*/
public static function sampleFr(): string {
return 'Name::fr::34'; /*34:fr*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromJa(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toJa(): string {
if (Name::validateJa($this->ja)) {
return $this->ja; /*string*/
}
throw new Exception('never get to this Name::ja');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateJa(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ja");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getJa(): string {
if (Name::validateJa($this->ja)) {
return $this->ja;
}
throw new Exception('never get to getJa Name::ja');
}
/**
* @return string
*/
public static function sampleJa(): string {
return 'Name::ja::35'; /*35:ja*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromKo(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toKo(): string {
if (Name::validateKo($this->ko)) {
return $this->ko; /*string*/
}
throw new Exception('never get to this Name::ko');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateKo(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ko");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getKo(): string {
if (Name::validateKo($this->ko)) {
return $this->ko;
}
throw new Exception('never get to getKo Name::ko');
}
/**
* @return string
*/
public static function sampleKo(): string {
return 'Name::ko::36'; /*36:ko*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromRu(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toRu(): string {
if (Name::validateRu($this->ru)) {
return $this->ru; /*string*/
}
throw new Exception('never get to this Name::ru');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateRu(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ru");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getRu(): string {
if (Name::validateRu($this->ru)) {
return $this->ru;
}
throw new Exception('never get to getRu Name::ru');
}
/**
* @return string
*/
public static function sampleRu(): string {
return 'Name::ru::37'; /*37:ru*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromZh(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toZh(): string {
if (Name::validateZh($this->zh)) {
return $this->zh; /*string*/
}
throw new Exception('never get to this Name::zh');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateZh(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::zh");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getZh(): string {
if (Name::validateZh($this->zh)) {
return $this->zh;
}
throw new Exception('never get to getZh Name::zh');
}
/**
* @return string
*/
public static function sampleZh(): string {
return 'Name::zh::38'; /*38:zh*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Name::validateDe($this->de)
|| Name::validateEn($this->en)
|| Name::validateEs($this->es)
|| Name::validateFr($this->fr)
|| Name::validateJa($this->ja)
|| Name::validateKo($this->ko)
|| Name::validateRu($this->ru)
|| Name::validateZh($this->zh);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'de'} = $this->toDe();
$out->{'en'} = $this->toEn();
$out->{'es'} = $this->toEs();
$out->{'fr'} = $this->toFr();
$out->{'ja'} = $this->toJa();
$out->{'ko'} = $this->toKo();
$out->{'ru'} = $this->toRu();
$out->{'zh'} = $this->toZh();
return $out;
}
/**
* @param stdClass $obj
* @return Name
* @throws Exception
*/
public static function from(stdClass $obj): Name {
return new Name(
Name::fromDe($obj->{'de'})
,Name::fromEn($obj->{'en'})
,Name::fromEs($obj->{'es'})
,Name::fromFr($obj->{'fr'})
,Name::fromJa($obj->{'ja'})
,Name::fromKo($obj->{'ko'})
,Name::fromRu($obj->{'ru'})
,Name::fromZh($obj->{'zh'})
);
}
/**
* @return Name
*/
public static function sample(): Name {
return new Name(
Name::sampleDe()
,Name::sampleEn()
,Name::sampleEs()
,Name::sampleFr()
,Name::sampleJa()
,Name::sampleKo()
,Name::sampleRu()
,Name::sampleZh()
);
}
}
// This is a autogenerated file:Position
class Position {
private float $x; // json:x Required
private float $y; // json:y Required
private float $z; // json:z Required
/**
* @param float $x
* @param float $y
* @param float $z
*/
public function __construct(float $x, float $y, float $z) {
$this->x = $x;
$this->y = $y;
$this->z = $z;
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromX(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toX(): float {
if (Position::validateX($this->x)) {
return $this->x; /*float*/
}
throw new Exception('never get to this Position::x');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateX(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::x");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getX(): float {
if (Position::validateX($this->x)) {
return $this->x;
}
throw new Exception('never get to getX Position::x');
}
/**
* @return float
*/
public static function sampleX(): float {
return 31.031; /*31:x*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromY(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toY(): float {
if (Position::validateY($this->y)) {
return $this->y; /*float*/
}
throw new Exception('never get to this Position::y');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateY(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::y");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getY(): float {
if (Position::validateY($this->y)) {
return $this->y;
}
throw new Exception('never get to getY Position::y');
}
/**
* @return float
*/
public static function sampleY(): float {
return 32.032; /*32:y*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromZ(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toZ(): float {
if (Position::validateZ($this->z)) {
return $this->z; /*float*/
}
throw new Exception('never get to this Position::z');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateZ(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::z");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getZ(): float {
if (Position::validateZ($this->z)) {
return $this->z;
}
throw new Exception('never get to getZ Position::z');
}
/**
* @return float
*/
public static function sampleZ(): float {
return 33.033; /*33:z*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Position::validateX($this->x)
|| Position::validateY($this->y)
|| Position::validateZ($this->z);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'x'} = $this->toX();
$out->{'y'} = $this->toY();
$out->{'z'} = $this->toZ();
return $out;
}
/**
* @param stdClass $obj
* @return Position
* @throws Exception
*/
public static function from(stdClass $obj): Position {
return new Position(
Position::fromX($obj->{'x'})
,Position::fromY($obj->{'y'})
,Position::fromZ($obj->{'z'})
);
}
/**
* @return Position
*/
public static function sample(): Position {
return new Position(
Position::sampleX()
,Position::sampleY()
,Position::sampleZ()
);
}
}
from typing import Any, Optional, List, TypeVar, Callable, Type, cast
T = TypeVar("T")
def from_str(x: Any) -> str:
assert isinstance(x, str)
return x
def from_float(x: Any) -> float:
assert isinstance(x, (float, int)) and not isinstance(x, bool)
return float(x)
def to_float(x: Any) -> float:
assert isinstance(x, (int, float))
return x
def from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
def from_bool(x: Any) -> bool:
assert isinstance(x, bool)
return x
def from_none(x: Any) -> Any:
assert x is None
return x
def from_union(fs, x):
for f in fs:
try:
return f(x)
except:
pass
assert False
def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
assert isinstance(x, list)
return [f(y) for y in x]
def to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
class Name:
de: str
en: str
es: str
fr: str
ja: str
ko: str
ru: str
zh: str
def __init__(self, de: str, en: str, es: str, fr: str, ja: str, ko: str, ru: str, zh: str) -> None:
self.de = de
self.en = en
self.es = es
self.fr = fr
self.ja = ja
self.ko = ko
self.ru = ru
self.zh = zh
@staticmethod
def from_dict(obj: Any) -> 'Name':
assert isinstance(obj, dict)
de = from_str(obj.get("de"))
en = from_str(obj.get("en"))
es = from_str(obj.get("es"))
fr = from_str(obj.get("fr"))
ja = from_str(obj.get("ja"))
ko = from_str(obj.get("ko"))
ru = from_str(obj.get("ru"))
zh = from_str(obj.get("zh"))
return Name(de, en, es, fr, ja, ko, ru, zh)
def to_dict(self) -> dict:
result: dict = {}
result["de"] = from_str(self.de)
result["en"] = from_str(self.en)
result["es"] = from_str(self.es)
result["fr"] = from_str(self.fr)
result["ja"] = from_str(self.ja)
result["ko"] = from_str(self.ko)
result["ru"] = from_str(self.ru)
result["zh"] = from_str(self.zh)
return result
class Position:
x: float
y: float
z: float
def __init__(self, x: float, y: float, z: float) -> None:
self.x = x
self.y = y
self.z = z
@staticmethod
def from_dict(obj: Any) -> 'Position':
assert isinstance(obj, dict)
x = from_float(obj.get("x"))
y = from_float(obj.get("y"))
z = from_float(obj.get("z"))
return Position(x, y, z)
def to_dict(self) -> dict:
result: dict = {}
result["x"] = to_float(self.x)
result["y"] = to_float(self.y)
result["z"] = to_float(self.z)
return result
class MapSolarSystem:
key: int
border: Optional[bool]
constellation_id: int
corridor: Optional[bool]
disallowed_anchor_categories: Optional[List[int]]
disallowed_anchor_groups: Optional[List[int]]
faction_id: Optional[int]
fringe: Optional[bool]
hub: Optional[bool]
international: Optional[bool]
luminosity: Optional[float]
name: Name
planet_i_ds: Optional[List[int]]
position: Position
radius: float
regional: Optional[bool]
region_id: int
security_class: Optional[str]
security_status: float
stargate_i_ds: Optional[List[int]]
star_id: Optional[int]
visual_effect: Optional[str]
wormhole_class_id: Optional[int]
def __init__(self, key: int, border: Optional[bool], constellation_id: int, corridor: Optional[bool], disallowed_anchor_categories: Optional[List[int]], disallowed_anchor_groups: Optional[List[int]], faction_id: Optional[int], fringe: Optional[bool], hub: Optional[bool], international: Optional[bool], luminosity: Optional[float], name: Name, planet_i_ds: Optional[List[int]], position: Position, radius: float, regional: Optional[bool], region_id: int, security_class: Optional[str], security_status: float, stargate_i_ds: Optional[List[int]], star_id: Optional[int], visual_effect: Optional[str], wormhole_class_id: Optional[int]) -> None:
self.key = key
self.border = border
self.constellation_id = constellation_id
self.corridor = corridor
self.disallowed_anchor_categories = disallowed_anchor_categories
self.disallowed_anchor_groups = disallowed_anchor_groups
self.faction_id = faction_id
self.fringe = fringe
self.hub = hub
self.international = international
self.luminosity = luminosity
self.name = name
self.planet_i_ds = planet_i_ds
self.position = position
self.radius = radius
self.regional = regional
self.region_id = region_id
self.security_class = security_class
self.security_status = security_status
self.stargate_i_ds = stargate_i_ds
self.star_id = star_id
self.visual_effect = visual_effect
self.wormhole_class_id = wormhole_class_id
@staticmethod
def from_dict(obj: Any) -> 'MapSolarSystem':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
border = from_union([from_bool, from_none], obj.get("border"))
constellation_id = from_int(obj.get("constellationID"))
corridor = from_union([from_bool, from_none], obj.get("corridor"))
disallowed_anchor_categories = from_union([lambda x: from_list(from_int, x), from_none], obj.get("disallowedAnchorCategories"))
disallowed_anchor_groups = from_union([lambda x: from_list(from_int, x), from_none], obj.get("disallowedAnchorGroups"))
faction_id = from_union([from_int, from_none], obj.get("factionID"))
fringe = from_union([from_bool, from_none], obj.get("fringe"))
hub = from_union([from_bool, from_none], obj.get("hub"))
international = from_union([from_bool, from_none], obj.get("international"))
luminosity = from_union([from_float, from_none], obj.get("luminosity"))
name = Name.from_dict(obj.get("name"))
planet_i_ds = from_union([lambda x: from_list(from_int, x), from_none], obj.get("planetIDs"))
position = Position.from_dict(obj.get("position"))
radius = from_float(obj.get("radius"))
regional = from_union([from_bool, from_none], obj.get("regional"))
region_id = from_int(obj.get("regionID"))
security_class = from_union([from_str, from_none], obj.get("securityClass"))
security_status = from_float(obj.get("securityStatus"))
stargate_i_ds = from_union([lambda x: from_list(from_int, x), from_none], obj.get("stargateIDs"))
star_id = from_union([from_int, from_none], obj.get("starID"))
visual_effect = from_union([from_str, from_none], obj.get("visualEffect"))
wormhole_class_id = from_union([from_int, from_none], obj.get("wormholeClassID"))
return MapSolarSystem(key, border, constellation_id, corridor, disallowed_anchor_categories, disallowed_anchor_groups, faction_id, fringe, hub, international, luminosity, name, planet_i_ds, position, radius, regional, region_id, security_class, security_status, stargate_i_ds, star_id, visual_effect, wormhole_class_id)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
if self.border is not None:
result["border"] = from_union([from_bool, from_none], self.border)
result["constellationID"] = from_int(self.constellation_id)
if self.corridor is not None:
result["corridor"] = from_union([from_bool, from_none], self.corridor)
if self.disallowed_anchor_categories is not None:
result["disallowedAnchorCategories"] = from_union([lambda x: from_list(from_int, x), from_none], self.disallowed_anchor_categories)
if self.disallowed_anchor_groups is not None:
result["disallowedAnchorGroups"] = from_union([lambda x: from_list(from_int, x), from_none], self.disallowed_anchor_groups)
if self.faction_id is not None:
result["factionID"] = from_union([from_int, from_none], self.faction_id)
if self.fringe is not None:
result["fringe"] = from_union([from_bool, from_none], self.fringe)
if self.hub is not None:
result["hub"] = from_union([from_bool, from_none], self.hub)
if self.international is not None:
result["international"] = from_union([from_bool, from_none], self.international)
if self.luminosity is not None:
result["luminosity"] = from_union([to_float, from_none], self.luminosity)
result["name"] = to_class(Name, self.name)
if self.planet_i_ds is not None:
result["planetIDs"] = from_union([lambda x: from_list(from_int, x), from_none], self.planet_i_ds)
result["position"] = to_class(Position, self.position)
result["radius"] = to_float(self.radius)
if self.regional is not None:
result["regional"] = from_union([from_bool, from_none], self.regional)
result["regionID"] = from_int(self.region_id)
if self.security_class is not None:
result["securityClass"] = from_union([from_str, from_none], self.security_class)
result["securityStatus"] = to_float(self.security_status)
if self.stargate_i_ds is not None:
result["stargateIDs"] = from_union([lambda x: from_list(from_int, x), from_none], self.stargate_i_ds)
if self.star_id is not None:
result["starID"] = from_union([from_int, from_none], self.star_id)
if self.visual_effect is not None:
result["visualEffect"] = from_union([from_str, from_none], self.visual_effect)
if self.wormhole_class_id is not None:
result["wormholeClassID"] = from_union([from_int, from_none], self.wormhole_class_id)
return result
def map_solar_system_from_dict(s: Any) -> MapSolarSystem:
return MapSolarSystem.from_dict(s)
def map_solar_system_to_dict(x: MapSolarSystem) -> Any:
return to_class(MapSolarSystem, x)
// To parse this data:
//
// import { Convert, MapSolarSystem } from "./file";
//
// const mapSolarSystem = Convert.toMapSolarSystem(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface MapSolarSystem {
_key: number;
border?: boolean;
constellationID: number;
corridor?: boolean;
disallowedAnchorCategories?: number[];
disallowedAnchorGroups?: number[];
factionID?: number;
fringe?: boolean;
hub?: boolean;
international?: boolean;
luminosity?: number;
name: Name;
planetIDs?: number[];
position: Position;
radius: number;
regional?: boolean;
regionID: number;
securityClass?: string;
securityStatus: number;
stargateIDs?: number[];
starID?: number;
visualEffect?: string;
wormholeClassID?: number;
[property: string]: any;
}
export interface Name {
de: string;
en: string;
es: string;
fr: string;
ja: string;
ko: string;
ru: string;
zh: string;
[property: string]: any;
}
export interface Position {
x: number;
y: number;
z: number;
[property: string]: any;
}
// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
public static toMapSolarSystem(json: string): MapSolarSystem {
return cast(JSON.parse(json), r("MapSolarSystem"));
}
public static mapSolarSystemToJson(value: MapSolarSystem): string {
return JSON.stringify(uncast(value, r("MapSolarSystem")), null, 2);
}
}
function invalidValue(typ: any, val: any, key: any, parent: any = ''): never {
const prettyTyp = prettyTypeName(typ);
const parentText = parent ? ` on ${parent}` : '';
const keyText = key ? ` for key "${key}"` : '';
throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
}
function prettyTypeName(typ: any): string {
if (Array.isArray(typ)) {
if (typ.length === 2 && typ[0] === undefined) {
return `an optional ${prettyTypeName(typ[1])}`;
} else {
return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
}
} else if (typeof typ === "object" && typ.literal !== undefined) {
return typ.literal;
} else {
return typeof typ;
}
}
function jsonToJSProps(typ: any): any {
if (typ.jsonToJS === undefined) {
const map: any = {};
typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
typ.jsonToJS = map;
}
return typ.jsonToJS;
}
function jsToJSONProps(typ: any): any {
if (typ.jsToJSON === undefined) {
const map: any = {};
typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
typ.jsToJSON = map;
}
return typ.jsToJSON;
}
function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any {
function transformPrimitive(typ: string, val: any): any {
if (typeof typ === typeof val) return val;
return invalidValue(typ, val, key, parent);
}
function transformUnion(typs: any[], val: any): any {
// val must validate against one typ in typs
const l = typs.length;
for (let i = 0; i < l; i++) {
const typ = typs[i];
try {
return transform(val, typ, getProps);
} catch (_) {}
}
return invalidValue(typs, val, key, parent);
}
function transformEnum(cases: string[], val: any): any {
if (cases.indexOf(val) !== -1) return val;
return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
}
function transformArray(typ: any, val: any): any {
// val must be an array with no invalid elements
if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent);
return val.map(el => transform(el, typ, getProps));
}
function transformDate(val: any): any {
if (val === null) {
return null;
}
const d = new Date(val);
if (isNaN(d.valueOf())) {
return invalidValue(l("Date"), val, key, parent);
}
return d;
}
function transformObject(props: { [k: string]: any }, additional: any, val: any): any {
if (val === null || typeof val !== "object" || Array.isArray(val)) {
return invalidValue(l(ref || "object"), val, key, parent);
}
const result: any = {};
Object.getOwnPropertyNames(props).forEach(key => {
const prop = props[key];
const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
result[prop.key] = transform(v, prop.typ, getProps, key, ref);
});
Object.getOwnPropertyNames(val).forEach(key => {
if (!Object.prototype.hasOwnProperty.call(props, key)) {
result[key] = transform(val[key], additional, getProps, key, ref);
}
});
return result;
}
if (typ === "any") return val;
if (typ === null) {
if (val === null) return val;
return invalidValue(typ, val, key, parent);
}
if (typ === false) return invalidValue(typ, val, key, parent);
let ref: any = undefined;
while (typeof typ === "object" && typ.ref !== undefined) {
ref = typ.ref;
typ = typeMap[typ.ref];
}
if (Array.isArray(typ)) return transformEnum(typ, val);
if (typeof typ === "object") {
return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
: typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val)
: typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val)
: invalidValue(typ, val, key, parent);
}
// Numbers can be parsed by Date but shouldn't be.
if (typ === Date && typeof val !== "number") return transformDate(val);
return transformPrimitive(typ, val);
}
function cast<T>(val: any, typ: any): T {
return transform(val, typ, jsonToJSProps);
}
function uncast<T>(val: T, typ: any): any {
return transform(val, typ, jsToJSONProps);
}
function l(typ: any) {
return { literal: typ };
}
function a(typ: any) {
return { arrayItems: typ };
}
function u(...typs: any[]) {
return { unionMembers: typs };
}
function o(props: any[], additional: any) {
return { props, additional };
}
function m(additional: any) {
return { props: [], additional };
}
function r(name: string) {
return { ref: name };
}
const typeMap: any = {
"MapSolarSystem": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "border", js: "border", typ: u(undefined, true) },
{ json: "constellationID", js: "constellationID", typ: 0 },
{ json: "corridor", js: "corridor", typ: u(undefined, true) },
{ json: "disallowedAnchorCategories", js: "disallowedAnchorCategories", typ: u(undefined, a(0)) },
{ json: "disallowedAnchorGroups", js: "disallowedAnchorGroups", typ: u(undefined, a(0)) },
{ json: "factionID", js: "factionID", typ: u(undefined, 0) },
{ json: "fringe", js: "fringe", typ: u(undefined, true) },
{ json: "hub", js: "hub", typ: u(undefined, true) },
{ json: "international", js: "international", typ: u(undefined, true) },
{ json: "luminosity", js: "luminosity", typ: u(undefined, 3.14) },
{ json: "name", js: "name", typ: r("Name") },
{ json: "planetIDs", js: "planetIDs", typ: u(undefined, a(0)) },
{ json: "position", js: "position", typ: r("Position") },
{ json: "radius", js: "radius", typ: 3.14 },
{ json: "regional", js: "regional", typ: u(undefined, true) },
{ json: "regionID", js: "regionID", typ: 0 },
{ json: "securityClass", js: "securityClass", typ: u(undefined, "") },
{ json: "securityStatus", js: "securityStatus", typ: 3.14 },
{ json: "stargateIDs", js: "stargateIDs", typ: u(undefined, a(0)) },
{ json: "starID", js: "starID", typ: u(undefined, 0) },
{ json: "visualEffect", js: "visualEffect", typ: u(undefined, "") },
{ json: "wormholeClassID", js: "wormholeClassID", typ: u(undefined, 0) },
], "any"),
"Name": o([
{ json: "de", js: "de", typ: "" },
{ json: "en", js: "en", typ: "" },
{ json: "es", js: "es", typ: "" },
{ json: "fr", js: "fr", typ: "" },
{ json: "ja", js: "ja", typ: "" },
{ json: "ko", js: "ko", typ: "" },
{ json: "ru", js: "ru", typ: "" },
{ json: "zh", js: "zh", typ: "" },
], "any"),
"Position": o([
{ json: "x", js: "x", typ: 3.14 },
{ json: "y", js: "y", typ: 3.14 },
{ json: "z", js: "z", typ: 3.14 },
], "any"),
};