npcCorporations.jsonl
Schema
_key
(required): integer
Range: 1000001 .. 1000441allowedMemberRaces
: array of integer
Type:integer
Range: 1 .. 135ceoID
: integer
Range: 1 .. 3020068-
corporationTrades
: array of object_key
(required): integer
Range: 41 .. 89689_value
(required): number
Range: -1 .. 1
-
deleted
(required): boolean -
description
: objectde
: stringen
(required): stringes
(required): stringfr
(required): stringja
(required): stringko
(required): stringru
: stringzh
(required): string
-
divisions
: array of object_key
(required): integer
Range: 18 .. 24divisionNumber
(required): integer
Range: 1 .. 4leaderID
(required): integer
Range: 3008463 .. 3018998size
(required): integer
Range: 2 .. 100
-
enemyID
: integer
Range: 1000002 .. 1000298 -
exchangeRates
: array of object_key
(required): integer
Range: 1000002 .. 1000172_value
(required): number
Range: 0 .. 0.8
-
extent
(required): enum
Enum values:L
,G
,R
,N
,C
factionID
: integer
Range: 500001 .. 500029friendID
: integer
Range: 1000002 .. 1000441hasPlayerPersonnelManager
(required): booleaniconID
: integer
Range: 21 .. 25465initialPrice
(required): integer
Range: 0 .. 200-
investors
: array of object_key
(required): integer
Range: 1000002 .. 1000298_value
(required): integer
Range: 0 .. 100
-
lpOfferTables
: array of integer
Type:integer
Range: 3 .. 237 mainActivityID
: integer
Range: 1 .. 20memberLimit
(required): integer
Range: -1 .. -1minSecurity
(required): number
Range: -10 .. 2minimumJoinStanding
(required): integer
Range: 0 .. 1-
name
(required): objectde
(required): stringen
(required): stringes
(required): stringfr
(required): stringja
(required): stringko
(required): stringru
(required): stringzh
(required): string
-
raceID
: integer
Range: 1 .. 135 secondaryActivityID
: integer
Range: 2 .. 19sendCharTerminationMessage
(required): booleanshares
(required): integer
Range: 0 .. 2147483647size
(required): enum
Enum values:T
,H
,M
,L
,S
sizeFactor
: number
Range: 1 .. 2solarSystemID
: integer
Range: 30000001 .. 30100000stationID
: integer
Range: 60000001 .. 60015187taxRate
(required): number
Range: 0 .. 0.11tickerName
(required): stringuniqueName
(required): boolean
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var npcCorporation = NpcCorporation.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class NpcCorporation
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("allowedMemberRaces", NullValueHandling = NullValueHandling.Ignore)]
public long[] AllowedMemberRaces { get; set; }
[JsonProperty("ceoID", NullValueHandling = NullValueHandling.Ignore)]
public long? CeoId { get; set; }
[JsonProperty("corporationTrades", NullValueHandling = NullValueHandling.Ignore)]
public CorporationTrade[] CorporationTrades { get; set; }
[JsonProperty("deleted")]
public bool Deleted { get; set; }
[JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)]
public Description Description { get; set; }
[JsonProperty("divisions", NullValueHandling = NullValueHandling.Ignore)]
public Division[] Divisions { get; set; }
[JsonProperty("enemyID", NullValueHandling = NullValueHandling.Ignore)]
public long? EnemyId { get; set; }
[JsonProperty("exchangeRates", NullValueHandling = NullValueHandling.Ignore)]
public ExchangeRate[] ExchangeRates { get; set; }
[JsonProperty("extent")]
public Extent Extent { get; set; }
[JsonProperty("factionID", NullValueHandling = NullValueHandling.Ignore)]
public long? FactionId { get; set; }
[JsonProperty("friendID", NullValueHandling = NullValueHandling.Ignore)]
public long? FriendId { get; set; }
[JsonProperty("hasPlayerPersonnelManager")]
public bool HasPlayerPersonnelManager { get; set; }
[JsonProperty("iconID", NullValueHandling = NullValueHandling.Ignore)]
public long? IconId { get; set; }
[JsonProperty("initialPrice")]
public long InitialPrice { get; set; }
[JsonProperty("investors", NullValueHandling = NullValueHandling.Ignore)]
public Investor[] Investors { get; set; }
[JsonProperty("lpOfferTables", NullValueHandling = NullValueHandling.Ignore)]
public long[] LpOfferTables { get; set; }
[JsonProperty("mainActivityID", NullValueHandling = NullValueHandling.Ignore)]
public long? MainActivityId { get; set; }
[JsonProperty("memberLimit")]
public long MemberLimit { get; set; }
[JsonProperty("minimumJoinStanding")]
public long MinimumJoinStanding { get; set; }
[JsonProperty("minSecurity")]
[JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
public double MinSecurity { get; set; }
[JsonProperty("name")]
public Name Name { get; set; }
[JsonProperty("raceID", NullValueHandling = NullValueHandling.Ignore)]
public long? RaceId { get; set; }
[JsonProperty("secondaryActivityID", NullValueHandling = NullValueHandling.Ignore)]
public long? SecondaryActivityId { get; set; }
[JsonProperty("sendCharTerminationMessage")]
public bool SendCharTerminationMessage { get; set; }
[JsonProperty("shares")]
public long Shares { get; set; }
[JsonProperty("size")]
public Size Size { get; set; }
[JsonProperty("sizeFactor", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StickyMinMaxValueCheckConverter))]
public double? SizeFactor { get; set; }
[JsonProperty("solarSystemID", NullValueHandling = NullValueHandling.Ignore)]
public long? SolarSystemId { get; set; }
[JsonProperty("stationID", NullValueHandling = NullValueHandling.Ignore)]
public long? StationId { get; set; }
[JsonProperty("taxRate")]
[JsonConverter(typeof(IndigoMinMaxValueCheckConverter))]
public double TaxRate { get; set; }
[JsonProperty("tickerName")]
[JsonConverter(typeof(MinMaxLengthCheckConverter4))]
public string TickerName { get; set; }
[JsonProperty("uniqueName")]
public bool UniqueName { get; set; }
}
public partial class CorporationTrade
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("_value")]
[JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
public double Value { get; set; }
}
public partial class Description
{
[JsonProperty("de", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es")]
[JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr")]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja")]
[JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko")]
[JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonProperty("ru", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(HilariousMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonProperty("zh")]
[JsonConverter(typeof(AmbitiousMinMaxLengthCheckConverter))]
public string Zh { get; set; }
}
public partial class Division
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("divisionNumber")]
public long DivisionNumber { get; set; }
[JsonProperty("leaderID")]
public long LeaderId { get; set; }
[JsonProperty("size")]
public long Size { get; set; }
}
public partial class ExchangeRate
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("_value")]
[JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
public double Value { get; set; }
}
public partial class Investor
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("_value")]
public long Value { get; set; }
}
public partial class Name
{
[JsonProperty("de")]
[JsonConverter(typeof(CunningMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(MagentaMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es")]
[JsonConverter(typeof(FriskyMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr")]
[JsonConverter(typeof(MischievousMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja")]
[JsonConverter(typeof(BraggadociousMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko")]
[JsonConverter(typeof(MinMaxLengthCheckConverter1))]
public string Ko { get; set; }
[JsonProperty("ru")]
[JsonConverter(typeof(MinMaxLengthCheckConverter2))]
public string Ru { get; set; }
[JsonProperty("zh")]
[JsonConverter(typeof(MinMaxLengthCheckConverter3))]
public string Zh { get; set; }
}
public enum Extent { C, G, L, N, R };
public enum Size { H, L, M, S, T };
public partial class NpcCorporation
{
public static NpcCorporation FromJson(string json) => JsonConvert.DeserializeObject<NpcCorporation>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this NpcCorporation 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 =
{
ExtentConverter.Singleton,
SizeConverter.Singleton,
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 >= -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 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 >= 42 && value.Length <= 1325)
{
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 >= 42 && value.Length <= 1325)
{
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 >= 33 && value.Length <= 1202)
{
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 >= 33 && value.Length <= 1202)
{
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 >= 45 && value.Length <= 1355)
{
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 >= 45 && value.Length <= 1355)
{
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 >= 43 && value.Length <= 1390)
{
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 >= 43 && value.Length <= 1390)
{
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 >= 18 && value.Length <= 485)
{
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 >= 18 && value.Length <= 485)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndigoMinMaxLengthCheckConverter Singleton = new IndigoMinMaxLengthCheckConverter();
}
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 >= 28 && value.Length <= 594)
{
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 >= 28 && value.Length <= 594)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndecentMinMaxLengthCheckConverter Singleton = new IndecentMinMaxLengthCheckConverter();
}
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 >= 37 && value.Length <= 1394)
{
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 >= 37 && value.Length <= 1394)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly HilariousMinMaxLengthCheckConverter Singleton = new HilariousMinMaxLengthCheckConverter();
}
internal class AmbitiousMinMaxLengthCheckConverter : 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 >= 15 && value.Length <= 327)
{
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 >= 15 && value.Length <= 327)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly AmbitiousMinMaxLengthCheckConverter Singleton = new AmbitiousMinMaxLengthCheckConverter();
}
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 >= 0 && value <= 0.8)
{
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 && value <= 0.8)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly FluffyMinMaxValueCheckConverter Singleton = new FluffyMinMaxValueCheckConverter();
}
internal class ExtentConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(Extent) || t == typeof(Extent?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<string>(reader);
switch (value)
{
case "C":
return Extent.C;
case "G":
return Extent.G;
case "L":
return Extent.L;
case "N":
return Extent.N;
case "R":
return Extent.R;
}
throw new Exception("Cannot unmarshal type Extent");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (Extent)untypedValue;
switch (value)
{
case Extent.C:
serializer.Serialize(writer, "C");
return;
case Extent.G:
serializer.Serialize(writer, "G");
return;
case Extent.L:
serializer.Serialize(writer, "L");
return;
case Extent.N:
serializer.Serialize(writer, "N");
return;
case Extent.R:
serializer.Serialize(writer, "R");
return;
}
throw new Exception("Cannot marshal type Extent");
}
public static readonly ExtentConverter Singleton = new ExtentConverter();
}
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 >= -10 && value <= 2)
{
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 >= -10 && value <= 2)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly TentacledMinMaxValueCheckConverter Singleton = new TentacledMinMaxValueCheckConverter();
}
internal class CunningMinMaxLengthCheckConverter : 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 <= 48)
{
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 <= 48)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly CunningMinMaxLengthCheckConverter Singleton = new CunningMinMaxLengthCheckConverter();
}
internal class MagentaMinMaxLengthCheckConverter : 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 <= 31)
{
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 <= 31)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MagentaMinMaxLengthCheckConverter Singleton = new MagentaMinMaxLengthCheckConverter();
}
internal class FriskyMinMaxLengthCheckConverter : 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 <= 40)
{
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 <= 40)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FriskyMinMaxLengthCheckConverter Singleton = new FriskyMinMaxLengthCheckConverter();
}
internal class MischievousMinMaxLengthCheckConverter : 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 <= 47)
{
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 <= 47)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MischievousMinMaxLengthCheckConverter Singleton = new MischievousMinMaxLengthCheckConverter();
}
internal class BraggadociousMinMaxLengthCheckConverter : 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 <= 20)
{
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 <= 20)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly BraggadociousMinMaxLengthCheckConverter Singleton = new BraggadociousMinMaxLengthCheckConverter();
}
internal class MinMaxLengthCheckConverter1 : 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 <= 15)
{
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 <= 15)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter1 Singleton = new MinMaxLengthCheckConverter1();
}
internal class MinMaxLengthCheckConverter2 : 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 <= 65)
{
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 <= 65)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter2 Singleton = new MinMaxLengthCheckConverter2();
}
internal class MinMaxLengthCheckConverter3 : 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 MinMaxLengthCheckConverter3 Singleton = new MinMaxLengthCheckConverter3();
}
internal class SizeConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(Size) || t == typeof(Size?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<string>(reader);
switch (value)
{
case "H":
return Size.H;
case "L":
return Size.L;
case "M":
return Size.M;
case "S":
return Size.S;
case "T":
return Size.T;
}
throw new Exception("Cannot unmarshal type Size");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (Size)untypedValue;
switch (value)
{
case Size.H:
serializer.Serialize(writer, "H");
return;
case Size.L:
serializer.Serialize(writer, "L");
return;
case Size.M:
serializer.Serialize(writer, "M");
return;
case Size.S:
serializer.Serialize(writer, "S");
return;
case Size.T:
serializer.Serialize(writer, "T");
return;
}
throw new Exception("Cannot marshal type Size");
}
public static readonly SizeConverter Singleton = new SizeConverter();
}
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 >= 1 && value <= 2)
{
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 <= 2)
{
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 >= 0 && value <= 0.11)
{
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 && value <= 0.11)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndigoMinMaxValueCheckConverter Singleton = new IndigoMinMaxValueCheckConverter();
}
internal class MinMaxLengthCheckConverter4 : 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 <= 5)
{
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 <= 5)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter4 Singleton = new MinMaxLengthCheckConverter4();
}
}
// 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:
//
// npcCorporation, err := UnmarshalNpcCorporation(bytes)
// bytes, err = npcCorporation.Marshal()
package model
import "encoding/json"
func UnmarshalNpcCorporation(data []byte) (NpcCorporation, error) {
var r NpcCorporation
err := json.Unmarshal(data, &r)
return r, err
}
func (r *NpcCorporation) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type NpcCorporation struct {
Key int64 `json:"_key"`
AllowedMemberRaces []int64 `json:"allowedMemberRaces,omitempty"`
CeoID *int64 `json:"ceoID,omitempty"`
CorporationTrades []CorporationTrade `json:"corporationTrades,omitempty"`
Deleted bool `json:"deleted"`
Description *Description `json:"description,omitempty"`
Divisions []Division `json:"divisions,omitempty"`
EnemyID *int64 `json:"enemyID,omitempty"`
ExchangeRates []ExchangeRate `json:"exchangeRates,omitempty"`
Extent Extent `json:"extent"`
FactionID *int64 `json:"factionID,omitempty"`
FriendID *int64 `json:"friendID,omitempty"`
HasPlayerPersonnelManager bool `json:"hasPlayerPersonnelManager"`
IconID *int64 `json:"iconID,omitempty"`
InitialPrice int64 `json:"initialPrice"`
Investors []Investor `json:"investors,omitempty"`
LpOfferTables []int64 `json:"lpOfferTables,omitempty"`
MainActivityID *int64 `json:"mainActivityID,omitempty"`
MemberLimit int64 `json:"memberLimit"`
MinimumJoinStanding int64 `json:"minimumJoinStanding"`
MinSecurity float64 `json:"minSecurity"`
Name Name `json:"name"`
RaceID *int64 `json:"raceID,omitempty"`
SecondaryActivityID *int64 `json:"secondaryActivityID,omitempty"`
SendCharTerminationMessage bool `json:"sendCharTerminationMessage"`
Shares int64 `json:"shares"`
Size Size `json:"size"`
SizeFactor *float64 `json:"sizeFactor,omitempty"`
SolarSystemID *int64 `json:"solarSystemID,omitempty"`
StationID *int64 `json:"stationID,omitempty"`
TaxRate float64 `json:"taxRate"`
TickerName string `json:"tickerName"`
UniqueName bool `json:"uniqueName"`
}
type CorporationTrade struct {
Key int64 `json:"_key"`
Value float64 `json:"_value"`
}
type Description struct {
De *string `json:"de,omitempty"`
En string `json:"en"`
Es string `json:"es"`
Fr string `json:"fr"`
Ja string `json:"ja"`
Ko string `json:"ko"`
Ru *string `json:"ru,omitempty"`
Zh string `json:"zh"`
}
type Division struct {
Key int64 `json:"_key"`
DivisionNumber int64 `json:"divisionNumber"`
LeaderID int64 `json:"leaderID"`
Size int64 `json:"size"`
}
type ExchangeRate struct {
Key int64 `json:"_key"`
Value float64 `json:"_value"`
}
type Investor struct {
Key int64 `json:"_key"`
Value int64 `json:"_value"`
}
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 Extent string
const (
C Extent = "C"
ExtentL Extent = "L"
G Extent = "G"
N Extent = "N"
R Extent = "R"
)
type Size string
const (
H Size = "H"
M Size = "M"
S Size = "S"
SizeL Size = "L"
T Size = "T"
)
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 1000001,
"maximum": 1000441
},
"allowedMemberRaces": {
"type": "array",
"items": {
"type": "integer",
"minimum": 1,
"maximum": 135
},
"minItems": 1,
"maxItems": 5
},
"ceoID": {
"type": "integer",
"minimum": 1,
"maximum": 3020068
},
"corporationTrades": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 41,
"maximum": 89689
},
"_value": {
"type": "number",
"minimum": -1.0,
"maximum": 1.0
}
},
"required": [
"_key",
"_value"
]
},
"minItems": 1,
"maxItems": 554
},
"deleted": {
"type": "boolean"
},
"description": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 42,
"maxLength": 1325
},
"en": {
"type": "string",
"minLength": 33,
"maxLength": 1202
},
"es": {
"type": "string",
"minLength": 45,
"maxLength": 1355
},
"fr": {
"type": "string",
"minLength": 43,
"maxLength": 1390
},
"ja": {
"type": "string",
"minLength": 18,
"maxLength": 485
},
"ko": {
"type": "string",
"minLength": 28,
"maxLength": 594
},
"ru": {
"type": "string",
"minLength": 37,
"maxLength": 1394
},
"zh": {
"type": "string",
"minLength": 15,
"maxLength": 327
}
},
"required": [
"en",
"es",
"fr",
"ja",
"ko",
"zh"
]
},
"divisions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 18,
"maximum": 24
},
"divisionNumber": {
"type": "integer",
"minimum": 1,
"maximum": 4
},
"leaderID": {
"type": "integer",
"minimum": 3008463,
"maximum": 3018998
},
"size": {
"type": "integer",
"minimum": 2,
"maximum": 100
}
},
"required": [
"_key",
"divisionNumber",
"leaderID",
"size"
]
},
"minItems": 1,
"maxItems": 4
},
"enemyID": {
"type": "integer",
"minimum": 1000002,
"maximum": 1000298
},
"exchangeRates": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 1000002,
"maximum": 1000172
},
"_value": {
"type": "number",
"minimum": 0.0,
"maximum": 0.8
}
},
"required": [
"_key",
"_value"
]
},
"minItems": 146,
"maxItems": 146
},
"extent": {
"type": "string",
"enum": [
"L",
"G",
"R",
"N",
"C"
]
},
"factionID": {
"type": "integer",
"minimum": 500001,
"maximum": 500029
},
"friendID": {
"type": "integer",
"minimum": 1000002,
"maximum": 1000441
},
"hasPlayerPersonnelManager": {
"type": "boolean"
},
"iconID": {
"type": "integer",
"minimum": 21,
"maximum": 25465
},
"initialPrice": {
"type": "integer",
"minimum": 0,
"maximum": 200
},
"investors": {
"type": "array",
"items": {
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 1000002,
"maximum": 1000298
},
"_value": {
"type": "integer",
"minimum": 0,
"maximum": 100
}
},
"required": [
"_key",
"_value"
]
},
"minItems": 1,
"maxItems": 4
},
"lpOfferTables": {
"type": "array",
"items": {
"type": "integer",
"minimum": 3,
"maximum": 237
},
"minItems": 1,
"maxItems": 6
},
"mainActivityID": {
"type": "integer",
"minimum": 1,
"maximum": 20
},
"memberLimit": {
"type": "integer",
"minimum": -1,
"maximum": -1
},
"minSecurity": {
"type": "number",
"minimum": -10.0,
"maximum": 2.0
},
"minimumJoinStanding": {
"type": "integer",
"minimum": 0,
"maximum": 1
},
"name": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 3,
"maxLength": 48
},
"en": {
"type": "string",
"minLength": 3,
"maxLength": 31
},
"es": {
"type": "string",
"minLength": 3,
"maxLength": 40
},
"fr": {
"type": "string",
"minLength": 3,
"maxLength": 47
},
"ja": {
"type": "string",
"minLength": 2,
"maxLength": 20
},
"ko": {
"type": "string",
"minLength": 2,
"maxLength": 15
},
"ru": {
"type": "string",
"minLength": 3,
"maxLength": 65
},
"zh": {
"type": "string",
"minLength": 3,
"maxLength": 19
}
},
"required": [
"de",
"en",
"es",
"fr",
"ja",
"ko",
"ru",
"zh"
]
},
"raceID": {
"type": "integer",
"minimum": 1,
"maximum": 135
},
"secondaryActivityID": {
"type": "integer",
"minimum": 2,
"maximum": 19
},
"sendCharTerminationMessage": {
"type": "boolean"
},
"shares": {
"type": "integer",
"minimum": 0,
"maximum": 2147483647
},
"size": {
"type": "string",
"enum": [
"T",
"H",
"M",
"L",
"S"
]
},
"sizeFactor": {
"type": "number",
"minimum": 1.0,
"maximum": 2.0
},
"solarSystemID": {
"type": "integer",
"minimum": 30000001,
"maximum": 30100000
},
"stationID": {
"type": "integer",
"minimum": 60000001,
"maximum": 60015187
},
"taxRate": {
"type": "number",
"minimum": 0.0,
"maximum": 0.11
},
"tickerName": {
"type": "string",
"minLength": 1,
"maxLength": 5
},
"uniqueName": {
"type": "boolean"
}
},
"required": [
"_key",
"deleted",
"extent",
"hasPlayerPersonnelManager",
"initialPrice",
"memberLimit",
"minSecurity",
"minimumJoinStanding",
"name",
"sendCharTerminationMessage",
"shares",
"size",
"taxRate",
"tickerName",
"uniqueName"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val npcCorporation = json.parse(NpcCorporation.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class NpcCorporation (
@SerialName("_key")
val key: Long,
val allowedMemberRaces: List<Long>? = null,
@SerialName("ceoID")
val ceoId: Long? = null,
val corporationTrades: List<CorporationTrade>? = null,
val deleted: Boolean,
val description: Description? = null,
val divisions: List<Division>? = null,
@SerialName("enemyID")
val enemyId: Long? = null,
val exchangeRates: List<ExchangeRate>? = null,
val extent: Extent,
@SerialName("factionID")
val factionId: Long? = null,
@SerialName("friendID")
val friendId: Long? = null,
val hasPlayerPersonnelManager: Boolean,
@SerialName("iconID")
val iconId: Long? = null,
val initialPrice: Long,
val investors: List<Investor>? = null,
val lpOfferTables: List<Long>? = null,
@SerialName("mainActivityID")
val mainActivityId: Long? = null,
val memberLimit: Long,
val minimumJoinStanding: Long,
val minSecurity: Double,
val name: Name,
@SerialName("raceID")
val raceId: Long? = null,
@SerialName("secondaryActivityID")
val secondaryActivityId: Long? = null,
val sendCharTerminationMessage: Boolean,
val shares: Long,
val size: Size,
val sizeFactor: Double? = null,
@SerialName("solarSystemID")
val solarSystemId: Long? = null,
@SerialName("stationID")
val stationId: Long? = null,
val taxRate: Double,
val tickerName: String,
val uniqueName: Boolean
)
@Serializable
data class CorporationTrade (
@SerialName("_key")
val key: Long,
@SerialName("_value")
val value: Double
)
@Serializable
data class Description (
val de: String? = null,
val en: String,
val es: String,
val fr: String,
val ja: String,
val ko: String,
val ru: String? = null,
val zh: String
)
@Serializable
data class Division (
@SerialName("_key")
val key: Long,
val divisionNumber: Long,
@SerialName("leaderID")
val leaderId: Long,
val size: Long
)
@Serializable
data class ExchangeRate (
@SerialName("_key")
val key: Long,
@SerialName("_value")
val value: Double
)
@Serializable
enum class Extent(val value: String) {
@SerialName("C") C("C"),
@SerialName("G") G("G"),
@SerialName("L") L("L"),
@SerialName("N") N("N"),
@SerialName("R") R("R");
}
@Serializable
data class Investor (
@SerialName("_key")
val key: Long,
@SerialName("_value")
val value: Long
)
@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
enum class Size(val value: String) {
@SerialName("H") H("H"),
@SerialName("L") L("L"),
@SerialName("M") M("M"),
@SerialName("S") S("S"),
@SerialName("T") T("T");
}
<?php
// This is a autogenerated file:NpcCorporation
class NpcCorporation {
private int $key; // json:_key Required
private ?array $allowedMemberRaces; // json:allowedMemberRaces Optional
private ?int $ceoId; // json:ceoID Optional
private ?array $corporationTrades; // json:corporationTrades Optional
private bool $deleted; // json:deleted Required
private ?Description $description; // json:description Optional
private ?array $divisions; // json:divisions Optional
private ?int $enemyId; // json:enemyID Optional
private ?array $exchangeRates; // json:exchangeRates Optional
private Extent $extent; // json:extent Required
private ?int $factionId; // json:factionID Optional
private ?int $friendId; // json:friendID Optional
private bool $hasPlayerPersonnelManager; // json:hasPlayerPersonnelManager Required
private ?int $iconId; // json:iconID Optional
private int $initialPrice; // json:initialPrice Required
private ?array $investors; // json:investors Optional
private ?array $lpOfferTables; // json:lpOfferTables Optional
private ?int $mainActivityId; // json:mainActivityID Optional
private int $memberLimit; // json:memberLimit Required
private int $minimumJoinStanding; // json:minimumJoinStanding Required
private float $minSecurity; // json:minSecurity Required
private Name $name; // json:name Required
private ?int $raceId; // json:raceID Optional
private ?int $secondaryActivityId; // json:secondaryActivityID Optional
private bool $sendCharTerminationMessage; // json:sendCharTerminationMessage Required
private int $shares; // json:shares Required
private Size $size; // json:size Required
private ?float $sizeFactor; // json:sizeFactor Optional
private ?int $solarSystemId; // json:solarSystemID Optional
private ?int $stationId; // json:stationID Optional
private float $taxRate; // json:taxRate Required
private string $tickerName; // json:tickerName Required
private bool $uniqueName; // json:uniqueName Required
/**
* @param int $key
* @param array|null $allowedMemberRaces
* @param int|null $ceoId
* @param array|null $corporationTrades
* @param bool $deleted
* @param Description|null $description
* @param array|null $divisions
* @param int|null $enemyId
* @param array|null $exchangeRates
* @param Extent $extent
* @param int|null $factionId
* @param int|null $friendId
* @param bool $hasPlayerPersonnelManager
* @param int|null $iconId
* @param int $initialPrice
* @param array|null $investors
* @param array|null $lpOfferTables
* @param int|null $mainActivityId
* @param int $memberLimit
* @param int $minimumJoinStanding
* @param float $minSecurity
* @param Name $name
* @param int|null $raceId
* @param int|null $secondaryActivityId
* @param bool $sendCharTerminationMessage
* @param int $shares
* @param Size $size
* @param float|null $sizeFactor
* @param int|null $solarSystemId
* @param int|null $stationId
* @param float $taxRate
* @param string $tickerName
* @param bool $uniqueName
*/
public function __construct(int $key, ?array $allowedMemberRaces, ?int $ceoId, ?array $corporationTrades, bool $deleted, ?Description $description, ?array $divisions, ?int $enemyId, ?array $exchangeRates, Extent $extent, ?int $factionId, ?int $friendId, bool $hasPlayerPersonnelManager, ?int $iconId, int $initialPrice, ?array $investors, ?array $lpOfferTables, ?int $mainActivityId, int $memberLimit, int $minimumJoinStanding, float $minSecurity, Name $name, ?int $raceId, ?int $secondaryActivityId, bool $sendCharTerminationMessage, int $shares, Size $size, ?float $sizeFactor, ?int $solarSystemId, ?int $stationId, float $taxRate, string $tickerName, bool $uniqueName) {
$this->key = $key;
$this->allowedMemberRaces = $allowedMemberRaces;
$this->ceoId = $ceoId;
$this->corporationTrades = $corporationTrades;
$this->deleted = $deleted;
$this->description = $description;
$this->divisions = $divisions;
$this->enemyId = $enemyId;
$this->exchangeRates = $exchangeRates;
$this->extent = $extent;
$this->factionId = $factionId;
$this->friendId = $friendId;
$this->hasPlayerPersonnelManager = $hasPlayerPersonnelManager;
$this->iconId = $iconId;
$this->initialPrice = $initialPrice;
$this->investors = $investors;
$this->lpOfferTables = $lpOfferTables;
$this->mainActivityId = $mainActivityId;
$this->memberLimit = $memberLimit;
$this->minimumJoinStanding = $minimumJoinStanding;
$this->minSecurity = $minSecurity;
$this->name = $name;
$this->raceId = $raceId;
$this->secondaryActivityId = $secondaryActivityId;
$this->sendCharTerminationMessage = $sendCharTerminationMessage;
$this->shares = $shares;
$this->size = $size;
$this->sizeFactor = $sizeFactor;
$this->solarSystemId = $solarSystemId;
$this->stationId = $stationId;
$this->taxRate = $taxRate;
$this->tickerName = $tickerName;
$this->uniqueName = $uniqueName;
}
/**
* @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 (NpcCorporation::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this NpcCorporation::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (NpcCorporation::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey NpcCorporation::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromAllowedMemberRaces(?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 toAllowedMemberRaces(): ?array {
if (NpcCorporation::validateAllowedMemberRaces($this->allowedMemberRaces)) {
if (!is_null($this->allowedMemberRaces)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->allowedMemberRaces);
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::allowedMemberRaces');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateAllowedMemberRaces(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:NpcCorporation::allowedMemberRaces");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:NpcCorporation::allowedMemberRaces");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getAllowedMemberRaces(): ?array {
if (NpcCorporation::validateAllowedMemberRaces($this->allowedMemberRaces)) {
return $this->allowedMemberRaces;
}
throw new Exception('never get to getAllowedMemberRaces NpcCorporation::allowedMemberRaces');
}
/**
* @return ?array
*/
public static function sampleAllowedMemberRaces(): ?array {
return array(
32 /*32:*/
); /* 32:allowedMemberRaces*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromCeoId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toCeoId(): ?int {
if (NpcCorporation::validateCeoId($this->ceoId)) {
if (!is_null($this->ceoId)) {
return $this->ceoId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::ceoId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateCeoId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::ceoId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getCeoId(): ?int {
if (NpcCorporation::validateCeoId($this->ceoId)) {
return $this->ceoId;
}
throw new Exception('never get to getCeoId NpcCorporation::ceoId');
}
/**
* @return ?int
*/
public static function sampleCeoId(): ?int {
return 33; /*33:ceoId*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromCorporationTrades(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return CorporationTrade::from($value); /*class*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toCorporationTrades(): ?array {
if (NpcCorporation::validateCorporationTrades($this->corporationTrades)) {
if (!is_null($this->corporationTrades)) {
return array_map(function ($value) {
return $value->to(); /*class*/
}, $this->corporationTrades);
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::corporationTrades');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateCorporationTrades(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:NpcCorporation::corporationTrades");
}
array_walk($value, function($value_v) {
$value_v->validate();
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getCorporationTrades(): ?array {
if (NpcCorporation::validateCorporationTrades($this->corporationTrades)) {
return $this->corporationTrades;
}
throw new Exception('never get to getCorporationTrades NpcCorporation::corporationTrades');
}
/**
* @return ?array
*/
public static function sampleCorporationTrades(): ?array {
return array(
CorporationTrade::sample() /*34:*/
); /* 34:corporationTrades*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromDeleted(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toDeleted(): bool {
if (NpcCorporation::validateDeleted($this->deleted)) {
return $this->deleted; /*bool*/
}
throw new Exception('never get to this NpcCorporation::deleted');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateDeleted(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:NpcCorporation::deleted");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getDeleted(): bool {
if (NpcCorporation::validateDeleted($this->deleted)) {
return $this->deleted;
}
throw new Exception('never get to getDeleted NpcCorporation::deleted');
}
/**
* @return bool
*/
public static function sampleDeleted(): bool {
return true; /*35:deleted*/
}
/**
* @param ?stdClass $value
* @throws Exception
* @return ?Description
*/
public static function fromDescription(?stdClass $value): ?Description {
if (!is_null($value)) {
return Description::from($value); /*class*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?stdClass
*/
public function toDescription(): ?stdClass {
if (NpcCorporation::validateDescription($this->description)) {
if (!is_null($this->description)) {
return $this->description->to(); /*class*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::description');
}
/**
* @param Description|null
* @return bool
* @throws Exception
*/
public static function validateDescription(?Description $value): bool {
if (!is_null($value)) {
$value->validate();
}
return true;
}
/**
* @throws Exception
* @return ?Description
*/
public function getDescription(): ?Description {
if (NpcCorporation::validateDescription($this->description)) {
return $this->description;
}
throw new Exception('never get to getDescription NpcCorporation::description');
}
/**
* @return ?Description
*/
public static function sampleDescription(): ?Description {
return Description::sample(); /*36:description*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromDivisions(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return Division::from($value); /*class*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toDivisions(): ?array {
if (NpcCorporation::validateDivisions($this->divisions)) {
if (!is_null($this->divisions)) {
return array_map(function ($value) {
return $value->to(); /*class*/
}, $this->divisions);
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::divisions');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateDivisions(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:NpcCorporation::divisions");
}
array_walk($value, function($value_v) {
$value_v->validate();
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getDivisions(): ?array {
if (NpcCorporation::validateDivisions($this->divisions)) {
return $this->divisions;
}
throw new Exception('never get to getDivisions NpcCorporation::divisions');
}
/**
* @return ?array
*/
public static function sampleDivisions(): ?array {
return array(
Division::sample() /*37:*/
); /* 37:divisions*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromEnemyId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toEnemyId(): ?int {
if (NpcCorporation::validateEnemyId($this->enemyId)) {
if (!is_null($this->enemyId)) {
return $this->enemyId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::enemyId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateEnemyId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::enemyId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getEnemyId(): ?int {
if (NpcCorporation::validateEnemyId($this->enemyId)) {
return $this->enemyId;
}
throw new Exception('never get to getEnemyId NpcCorporation::enemyId');
}
/**
* @return ?int
*/
public static function sampleEnemyId(): ?int {
return 38; /*38:enemyId*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromExchangeRates(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return ExchangeRate::from($value); /*class*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toExchangeRates(): ?array {
if (NpcCorporation::validateExchangeRates($this->exchangeRates)) {
if (!is_null($this->exchangeRates)) {
return array_map(function ($value) {
return $value->to(); /*class*/
}, $this->exchangeRates);
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::exchangeRates');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateExchangeRates(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:NpcCorporation::exchangeRates");
}
array_walk($value, function($value_v) {
$value_v->validate();
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getExchangeRates(): ?array {
if (NpcCorporation::validateExchangeRates($this->exchangeRates)) {
return $this->exchangeRates;
}
throw new Exception('never get to getExchangeRates NpcCorporation::exchangeRates');
}
/**
* @return ?array
*/
public static function sampleExchangeRates(): ?array {
return array(
ExchangeRate::sample() /*39:*/
); /* 39:exchangeRates*/
}
/**
* @param string $value
* @throws Exception
* @return Extent
*/
public static function fromExtent(string $value): Extent {
return Extent::from($value); /*enum*/
}
/**
* @throws Exception
* @return string
*/
public function toExtent(): string {
if (NpcCorporation::validateExtent($this->extent)) {
return Extent::to($this->extent); /*enum*/
}
throw new Exception('never get to this NpcCorporation::extent');
}
/**
* @param Extent
* @return bool
* @throws Exception
*/
public static function validateExtent(Extent $value): bool {
Extent::to($value);
return true;
}
/**
* @throws Exception
* @return Extent
*/
public function getExtent(): Extent {
if (NpcCorporation::validateExtent($this->extent)) {
return $this->extent;
}
throw new Exception('never get to getExtent NpcCorporation::extent');
}
/**
* @return Extent
*/
public static function sampleExtent(): Extent {
return Extent::sample(); /*enum*/
}
/**
* @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 (NpcCorporation::validateFactionId($this->factionId)) {
if (!is_null($this->factionId)) {
return $this->factionId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::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:NpcCorporation::factionId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getFactionId(): ?int {
if (NpcCorporation::validateFactionId($this->factionId)) {
return $this->factionId;
}
throw new Exception('never get to getFactionId NpcCorporation::factionId');
}
/**
* @return ?int
*/
public static function sampleFactionId(): ?int {
return 41; /*41:factionId*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromFriendId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toFriendId(): ?int {
if (NpcCorporation::validateFriendId($this->friendId)) {
if (!is_null($this->friendId)) {
return $this->friendId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::friendId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateFriendId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::friendId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getFriendId(): ?int {
if (NpcCorporation::validateFriendId($this->friendId)) {
return $this->friendId;
}
throw new Exception('never get to getFriendId NpcCorporation::friendId');
}
/**
* @return ?int
*/
public static function sampleFriendId(): ?int {
return 42; /*42:friendId*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromHasPlayerPersonnelManager(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toHasPlayerPersonnelManager(): bool {
if (NpcCorporation::validateHasPlayerPersonnelManager($this->hasPlayerPersonnelManager)) {
return $this->hasPlayerPersonnelManager; /*bool*/
}
throw new Exception('never get to this NpcCorporation::hasPlayerPersonnelManager');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateHasPlayerPersonnelManager(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:NpcCorporation::hasPlayerPersonnelManager");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getHasPlayerPersonnelManager(): bool {
if (NpcCorporation::validateHasPlayerPersonnelManager($this->hasPlayerPersonnelManager)) {
return $this->hasPlayerPersonnelManager;
}
throw new Exception('never get to getHasPlayerPersonnelManager NpcCorporation::hasPlayerPersonnelManager');
}
/**
* @return bool
*/
public static function sampleHasPlayerPersonnelManager(): bool {
return true; /*43:hasPlayerPersonnelManager*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromIconId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toIconId(): ?int {
if (NpcCorporation::validateIconId($this->iconId)) {
if (!is_null($this->iconId)) {
return $this->iconId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::iconId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateIconId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::iconId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getIconId(): ?int {
if (NpcCorporation::validateIconId($this->iconId)) {
return $this->iconId;
}
throw new Exception('never get to getIconId NpcCorporation::iconId');
}
/**
* @return ?int
*/
public static function sampleIconId(): ?int {
return 44; /*44:iconId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromInitialPrice(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toInitialPrice(): int {
if (NpcCorporation::validateInitialPrice($this->initialPrice)) {
return $this->initialPrice; /*int*/
}
throw new Exception('never get to this NpcCorporation::initialPrice');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateInitialPrice(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::initialPrice");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getInitialPrice(): int {
if (NpcCorporation::validateInitialPrice($this->initialPrice)) {
return $this->initialPrice;
}
throw new Exception('never get to getInitialPrice NpcCorporation::initialPrice');
}
/**
* @return int
*/
public static function sampleInitialPrice(): int {
return 45; /*45:initialPrice*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromInvestors(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return Investor::from($value); /*class*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toInvestors(): ?array {
if (NpcCorporation::validateInvestors($this->investors)) {
if (!is_null($this->investors)) {
return array_map(function ($value) {
return $value->to(); /*class*/
}, $this->investors);
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::investors');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateInvestors(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:NpcCorporation::investors");
}
array_walk($value, function($value_v) {
$value_v->validate();
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getInvestors(): ?array {
if (NpcCorporation::validateInvestors($this->investors)) {
return $this->investors;
}
throw new Exception('never get to getInvestors NpcCorporation::investors');
}
/**
* @return ?array
*/
public static function sampleInvestors(): ?array {
return array(
Investor::sample() /*46:*/
); /* 46:investors*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromLpOfferTables(?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 toLpOfferTables(): ?array {
if (NpcCorporation::validateLpOfferTables($this->lpOfferTables)) {
if (!is_null($this->lpOfferTables)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->lpOfferTables);
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::lpOfferTables');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateLpOfferTables(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:NpcCorporation::lpOfferTables");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:NpcCorporation::lpOfferTables");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getLpOfferTables(): ?array {
if (NpcCorporation::validateLpOfferTables($this->lpOfferTables)) {
return $this->lpOfferTables;
}
throw new Exception('never get to getLpOfferTables NpcCorporation::lpOfferTables');
}
/**
* @return ?array
*/
public static function sampleLpOfferTables(): ?array {
return array(
47 /*47:*/
); /* 47:lpOfferTables*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromMainActivityId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toMainActivityId(): ?int {
if (NpcCorporation::validateMainActivityId($this->mainActivityId)) {
if (!is_null($this->mainActivityId)) {
return $this->mainActivityId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::mainActivityId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateMainActivityId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::mainActivityId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getMainActivityId(): ?int {
if (NpcCorporation::validateMainActivityId($this->mainActivityId)) {
return $this->mainActivityId;
}
throw new Exception('never get to getMainActivityId NpcCorporation::mainActivityId');
}
/**
* @return ?int
*/
public static function sampleMainActivityId(): ?int {
return 48; /*48:mainActivityId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromMemberLimit(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toMemberLimit(): int {
if (NpcCorporation::validateMemberLimit($this->memberLimit)) {
return $this->memberLimit; /*int*/
}
throw new Exception('never get to this NpcCorporation::memberLimit');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateMemberLimit(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::memberLimit");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getMemberLimit(): int {
if (NpcCorporation::validateMemberLimit($this->memberLimit)) {
return $this->memberLimit;
}
throw new Exception('never get to getMemberLimit NpcCorporation::memberLimit');
}
/**
* @return int
*/
public static function sampleMemberLimit(): int {
return 49; /*49:memberLimit*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromMinimumJoinStanding(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toMinimumJoinStanding(): int {
if (NpcCorporation::validateMinimumJoinStanding($this->minimumJoinStanding)) {
return $this->minimumJoinStanding; /*int*/
}
throw new Exception('never get to this NpcCorporation::minimumJoinStanding');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateMinimumJoinStanding(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::minimumJoinStanding");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getMinimumJoinStanding(): int {
if (NpcCorporation::validateMinimumJoinStanding($this->minimumJoinStanding)) {
return $this->minimumJoinStanding;
}
throw new Exception('never get to getMinimumJoinStanding NpcCorporation::minimumJoinStanding');
}
/**
* @return int
*/
public static function sampleMinimumJoinStanding(): int {
return 50; /*50:minimumJoinStanding*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromMinSecurity(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toMinSecurity(): float {
if (NpcCorporation::validateMinSecurity($this->minSecurity)) {
return $this->minSecurity; /*float*/
}
throw new Exception('never get to this NpcCorporation::minSecurity');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateMinSecurity(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:NpcCorporation::minSecurity");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getMinSecurity(): float {
if (NpcCorporation::validateMinSecurity($this->minSecurity)) {
return $this->minSecurity;
}
throw new Exception('never get to getMinSecurity NpcCorporation::minSecurity');
}
/**
* @return float
*/
public static function sampleMinSecurity(): float {
return 51.051; /*51:minSecurity*/
}
/**
* @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 (NpcCorporation::validateName($this->name)) {
return $this->name->to(); /*class*/
}
throw new Exception('never get to this NpcCorporation::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 (NpcCorporation::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName NpcCorporation::name');
}
/**
* @return Name
*/
public static function sampleName(): Name {
return Name::sample(); /*52:name*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromRaceId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toRaceId(): ?int {
if (NpcCorporation::validateRaceId($this->raceId)) {
if (!is_null($this->raceId)) {
return $this->raceId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::raceId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateRaceId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::raceId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getRaceId(): ?int {
if (NpcCorporation::validateRaceId($this->raceId)) {
return $this->raceId;
}
throw new Exception('never get to getRaceId NpcCorporation::raceId');
}
/**
* @return ?int
*/
public static function sampleRaceId(): ?int {
return 53; /*53:raceId*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromSecondaryActivityId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toSecondaryActivityId(): ?int {
if (NpcCorporation::validateSecondaryActivityId($this->secondaryActivityId)) {
if (!is_null($this->secondaryActivityId)) {
return $this->secondaryActivityId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::secondaryActivityId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateSecondaryActivityId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::secondaryActivityId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getSecondaryActivityId(): ?int {
if (NpcCorporation::validateSecondaryActivityId($this->secondaryActivityId)) {
return $this->secondaryActivityId;
}
throw new Exception('never get to getSecondaryActivityId NpcCorporation::secondaryActivityId');
}
/**
* @return ?int
*/
public static function sampleSecondaryActivityId(): ?int {
return 54; /*54:secondaryActivityId*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromSendCharTerminationMessage(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toSendCharTerminationMessage(): bool {
if (NpcCorporation::validateSendCharTerminationMessage($this->sendCharTerminationMessage)) {
return $this->sendCharTerminationMessage; /*bool*/
}
throw new Exception('never get to this NpcCorporation::sendCharTerminationMessage');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateSendCharTerminationMessage(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:NpcCorporation::sendCharTerminationMessage");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getSendCharTerminationMessage(): bool {
if (NpcCorporation::validateSendCharTerminationMessage($this->sendCharTerminationMessage)) {
return $this->sendCharTerminationMessage;
}
throw new Exception('never get to getSendCharTerminationMessage NpcCorporation::sendCharTerminationMessage');
}
/**
* @return bool
*/
public static function sampleSendCharTerminationMessage(): bool {
return true; /*55:sendCharTerminationMessage*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromShares(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toShares(): int {
if (NpcCorporation::validateShares($this->shares)) {
return $this->shares; /*int*/
}
throw new Exception('never get to this NpcCorporation::shares');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateShares(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::shares");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getShares(): int {
if (NpcCorporation::validateShares($this->shares)) {
return $this->shares;
}
throw new Exception('never get to getShares NpcCorporation::shares');
}
/**
* @return int
*/
public static function sampleShares(): int {
return 56; /*56:shares*/
}
/**
* @param string $value
* @throws Exception
* @return Size
*/
public static function fromSize(string $value): Size {
return Size::from($value); /*enum*/
}
/**
* @throws Exception
* @return string
*/
public function toSize(): string {
if (NpcCorporation::validateSize($this->size)) {
return Size::to($this->size); /*enum*/
}
throw new Exception('never get to this NpcCorporation::size');
}
/**
* @param Size
* @return bool
* @throws Exception
*/
public static function validateSize(Size $value): bool {
Size::to($value);
return true;
}
/**
* @throws Exception
* @return Size
*/
public function getSize(): Size {
if (NpcCorporation::validateSize($this->size)) {
return $this->size;
}
throw new Exception('never get to getSize NpcCorporation::size');
}
/**
* @return Size
*/
public static function sampleSize(): Size {
return Size::sample(); /*enum*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromSizeFactor(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toSizeFactor(): ?float {
if (NpcCorporation::validateSizeFactor($this->sizeFactor)) {
if (!is_null($this->sizeFactor)) {
return $this->sizeFactor; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::sizeFactor');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateSizeFactor(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:NpcCorporation::sizeFactor");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getSizeFactor(): ?float {
if (NpcCorporation::validateSizeFactor($this->sizeFactor)) {
return $this->sizeFactor;
}
throw new Exception('never get to getSizeFactor NpcCorporation::sizeFactor');
}
/**
* @return ?float
*/
public static function sampleSizeFactor(): ?float {
return 58.058; /*58:sizeFactor*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromSolarSystemId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toSolarSystemId(): ?int {
if (NpcCorporation::validateSolarSystemId($this->solarSystemId)) {
if (!is_null($this->solarSystemId)) {
return $this->solarSystemId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::solarSystemId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateSolarSystemId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::solarSystemId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getSolarSystemId(): ?int {
if (NpcCorporation::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId;
}
throw new Exception('never get to getSolarSystemId NpcCorporation::solarSystemId');
}
/**
* @return ?int
*/
public static function sampleSolarSystemId(): ?int {
return 59; /*59:solarSystemId*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromStationId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toStationId(): ?int {
if (NpcCorporation::validateStationId($this->stationId)) {
if (!is_null($this->stationId)) {
return $this->stationId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcCorporation::stationId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateStationId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcCorporation::stationId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getStationId(): ?int {
if (NpcCorporation::validateStationId($this->stationId)) {
return $this->stationId;
}
throw new Exception('never get to getStationId NpcCorporation::stationId');
}
/**
* @return ?int
*/
public static function sampleStationId(): ?int {
return 60; /*60:stationId*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromTaxRate(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toTaxRate(): float {
if (NpcCorporation::validateTaxRate($this->taxRate)) {
return $this->taxRate; /*float*/
}
throw new Exception('never get to this NpcCorporation::taxRate');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateTaxRate(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:NpcCorporation::taxRate");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getTaxRate(): float {
if (NpcCorporation::validateTaxRate($this->taxRate)) {
return $this->taxRate;
}
throw new Exception('never get to getTaxRate NpcCorporation::taxRate');
}
/**
* @return float
*/
public static function sampleTaxRate(): float {
return 61.061; /*61:taxRate*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromTickerName(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toTickerName(): string {
if (NpcCorporation::validateTickerName($this->tickerName)) {
return $this->tickerName; /*string*/
}
throw new Exception('never get to this NpcCorporation::tickerName');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateTickerName(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:NpcCorporation::tickerName");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getTickerName(): string {
if (NpcCorporation::validateTickerName($this->tickerName)) {
return $this->tickerName;
}
throw new Exception('never get to getTickerName NpcCorporation::tickerName');
}
/**
* @return string
*/
public static function sampleTickerName(): string {
return 'NpcCorporation::tickerName::62'; /*62:tickerName*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromUniqueName(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toUniqueName(): bool {
if (NpcCorporation::validateUniqueName($this->uniqueName)) {
return $this->uniqueName; /*bool*/
}
throw new Exception('never get to this NpcCorporation::uniqueName');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateUniqueName(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:NpcCorporation::uniqueName");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getUniqueName(): bool {
if (NpcCorporation::validateUniqueName($this->uniqueName)) {
return $this->uniqueName;
}
throw new Exception('never get to getUniqueName NpcCorporation::uniqueName');
}
/**
* @return bool
*/
public static function sampleUniqueName(): bool {
return true; /*63:uniqueName*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return NpcCorporation::validateKey($this->key)
|| NpcCorporation::validateAllowedMemberRaces($this->allowedMemberRaces)
|| NpcCorporation::validateCeoId($this->ceoId)
|| NpcCorporation::validateCorporationTrades($this->corporationTrades)
|| NpcCorporation::validateDeleted($this->deleted)
|| NpcCorporation::validateDescription($this->description)
|| NpcCorporation::validateDivisions($this->divisions)
|| NpcCorporation::validateEnemyId($this->enemyId)
|| NpcCorporation::validateExchangeRates($this->exchangeRates)
|| NpcCorporation::validateExtent($this->extent)
|| NpcCorporation::validateFactionId($this->factionId)
|| NpcCorporation::validateFriendId($this->friendId)
|| NpcCorporation::validateHasPlayerPersonnelManager($this->hasPlayerPersonnelManager)
|| NpcCorporation::validateIconId($this->iconId)
|| NpcCorporation::validateInitialPrice($this->initialPrice)
|| NpcCorporation::validateInvestors($this->investors)
|| NpcCorporation::validateLpOfferTables($this->lpOfferTables)
|| NpcCorporation::validateMainActivityId($this->mainActivityId)
|| NpcCorporation::validateMemberLimit($this->memberLimit)
|| NpcCorporation::validateMinimumJoinStanding($this->minimumJoinStanding)
|| NpcCorporation::validateMinSecurity($this->minSecurity)
|| NpcCorporation::validateName($this->name)
|| NpcCorporation::validateRaceId($this->raceId)
|| NpcCorporation::validateSecondaryActivityId($this->secondaryActivityId)
|| NpcCorporation::validateSendCharTerminationMessage($this->sendCharTerminationMessage)
|| NpcCorporation::validateShares($this->shares)
|| NpcCorporation::validateSize($this->size)
|| NpcCorporation::validateSizeFactor($this->sizeFactor)
|| NpcCorporation::validateSolarSystemId($this->solarSystemId)
|| NpcCorporation::validateStationId($this->stationId)
|| NpcCorporation::validateTaxRate($this->taxRate)
|| NpcCorporation::validateTickerName($this->tickerName)
|| NpcCorporation::validateUniqueName($this->uniqueName);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'allowedMemberRaces'} = $this->toAllowedMemberRaces();
$out->{'ceoID'} = $this->toCeoId();
$out->{'corporationTrades'} = $this->toCorporationTrades();
$out->{'deleted'} = $this->toDeleted();
$out->{'description'} = $this->toDescription();
$out->{'divisions'} = $this->toDivisions();
$out->{'enemyID'} = $this->toEnemyId();
$out->{'exchangeRates'} = $this->toExchangeRates();
$out->{'extent'} = $this->toExtent();
$out->{'factionID'} = $this->toFactionId();
$out->{'friendID'} = $this->toFriendId();
$out->{'hasPlayerPersonnelManager'} = $this->toHasPlayerPersonnelManager();
$out->{'iconID'} = $this->toIconId();
$out->{'initialPrice'} = $this->toInitialPrice();
$out->{'investors'} = $this->toInvestors();
$out->{'lpOfferTables'} = $this->toLpOfferTables();
$out->{'mainActivityID'} = $this->toMainActivityId();
$out->{'memberLimit'} = $this->toMemberLimit();
$out->{'minimumJoinStanding'} = $this->toMinimumJoinStanding();
$out->{'minSecurity'} = $this->toMinSecurity();
$out->{'name'} = $this->toName();
$out->{'raceID'} = $this->toRaceId();
$out->{'secondaryActivityID'} = $this->toSecondaryActivityId();
$out->{'sendCharTerminationMessage'} = $this->toSendCharTerminationMessage();
$out->{'shares'} = $this->toShares();
$out->{'size'} = $this->toSize();
$out->{'sizeFactor'} = $this->toSizeFactor();
$out->{'solarSystemID'} = $this->toSolarSystemId();
$out->{'stationID'} = $this->toStationId();
$out->{'taxRate'} = $this->toTaxRate();
$out->{'tickerName'} = $this->toTickerName();
$out->{'uniqueName'} = $this->toUniqueName();
return $out;
}
/**
* @param stdClass $obj
* @return NpcCorporation
* @throws Exception
*/
public static function from(stdClass $obj): NpcCorporation {
return new NpcCorporation(
NpcCorporation::fromKey($obj->{'_key'})
,NpcCorporation::fromAllowedMemberRaces($obj->{'allowedMemberRaces'})
,NpcCorporation::fromCeoId($obj->{'ceoID'})
,NpcCorporation::fromCorporationTrades($obj->{'corporationTrades'})
,NpcCorporation::fromDeleted($obj->{'deleted'})
,NpcCorporation::fromDescription($obj->{'description'})
,NpcCorporation::fromDivisions($obj->{'divisions'})
,NpcCorporation::fromEnemyId($obj->{'enemyID'})
,NpcCorporation::fromExchangeRates($obj->{'exchangeRates'})
,NpcCorporation::fromExtent($obj->{'extent'})
,NpcCorporation::fromFactionId($obj->{'factionID'})
,NpcCorporation::fromFriendId($obj->{'friendID'})
,NpcCorporation::fromHasPlayerPersonnelManager($obj->{'hasPlayerPersonnelManager'})
,NpcCorporation::fromIconId($obj->{'iconID'})
,NpcCorporation::fromInitialPrice($obj->{'initialPrice'})
,NpcCorporation::fromInvestors($obj->{'investors'})
,NpcCorporation::fromLpOfferTables($obj->{'lpOfferTables'})
,NpcCorporation::fromMainActivityId($obj->{'mainActivityID'})
,NpcCorporation::fromMemberLimit($obj->{'memberLimit'})
,NpcCorporation::fromMinimumJoinStanding($obj->{'minimumJoinStanding'})
,NpcCorporation::fromMinSecurity($obj->{'minSecurity'})
,NpcCorporation::fromName($obj->{'name'})
,NpcCorporation::fromRaceId($obj->{'raceID'})
,NpcCorporation::fromSecondaryActivityId($obj->{'secondaryActivityID'})
,NpcCorporation::fromSendCharTerminationMessage($obj->{'sendCharTerminationMessage'})
,NpcCorporation::fromShares($obj->{'shares'})
,NpcCorporation::fromSize($obj->{'size'})
,NpcCorporation::fromSizeFactor($obj->{'sizeFactor'})
,NpcCorporation::fromSolarSystemId($obj->{'solarSystemID'})
,NpcCorporation::fromStationId($obj->{'stationID'})
,NpcCorporation::fromTaxRate($obj->{'taxRate'})
,NpcCorporation::fromTickerName($obj->{'tickerName'})
,NpcCorporation::fromUniqueName($obj->{'uniqueName'})
);
}
/**
* @return NpcCorporation
*/
public static function sample(): NpcCorporation {
return new NpcCorporation(
NpcCorporation::sampleKey()
,NpcCorporation::sampleAllowedMemberRaces()
,NpcCorporation::sampleCeoId()
,NpcCorporation::sampleCorporationTrades()
,NpcCorporation::sampleDeleted()
,NpcCorporation::sampleDescription()
,NpcCorporation::sampleDivisions()
,NpcCorporation::sampleEnemyId()
,NpcCorporation::sampleExchangeRates()
,NpcCorporation::sampleExtent()
,NpcCorporation::sampleFactionId()
,NpcCorporation::sampleFriendId()
,NpcCorporation::sampleHasPlayerPersonnelManager()
,NpcCorporation::sampleIconId()
,NpcCorporation::sampleInitialPrice()
,NpcCorporation::sampleInvestors()
,NpcCorporation::sampleLpOfferTables()
,NpcCorporation::sampleMainActivityId()
,NpcCorporation::sampleMemberLimit()
,NpcCorporation::sampleMinimumJoinStanding()
,NpcCorporation::sampleMinSecurity()
,NpcCorporation::sampleName()
,NpcCorporation::sampleRaceId()
,NpcCorporation::sampleSecondaryActivityId()
,NpcCorporation::sampleSendCharTerminationMessage()
,NpcCorporation::sampleShares()
,NpcCorporation::sampleSize()
,NpcCorporation::sampleSizeFactor()
,NpcCorporation::sampleSolarSystemId()
,NpcCorporation::sampleStationId()
,NpcCorporation::sampleTaxRate()
,NpcCorporation::sampleTickerName()
,NpcCorporation::sampleUniqueName()
);
}
}
// This is a autogenerated file:CorporationTrade
class CorporationTrade {
private int $key; // json:_key Required
private float $value; // json:_value Required
/**
* @param int $key
* @param float $value
*/
public function __construct(int $key, float $value) {
$this->key = $key;
$this->value = $value;
}
/**
* @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 (CorporationTrade::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this CorporationTrade::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:CorporationTrade::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (CorporationTrade::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey CorporationTrade::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromValue(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toValue(): float {
if (CorporationTrade::validateValue($this->value)) {
return $this->value; /*float*/
}
throw new Exception('never get to this CorporationTrade::value');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateValue(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:CorporationTrade::value");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getValue(): float {
if (CorporationTrade::validateValue($this->value)) {
return $this->value;
}
throw new Exception('never get to getValue CorporationTrade::value');
}
/**
* @return float
*/
public static function sampleValue(): float {
return 32.032; /*32:value*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return CorporationTrade::validateKey($this->key)
|| CorporationTrade::validateValue($this->value);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'_value'} = $this->toValue();
return $out;
}
/**
* @param stdClass $obj
* @return CorporationTrade
* @throws Exception
*/
public static function from(stdClass $obj): CorporationTrade {
return new CorporationTrade(
CorporationTrade::fromKey($obj->{'_key'})
,CorporationTrade::fromValue($obj->{'_value'})
);
}
/**
* @return CorporationTrade
*/
public static function sample(): CorporationTrade {
return new CorporationTrade(
CorporationTrade::sampleKey()
,CorporationTrade::sampleValue()
);
}
}
// This is a autogenerated file:Description
class Description {
private ?string $de; // json:de Optional
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 Optional
private string $zh; // json:zh Required
/**
* @param string|null $de
* @param string $en
* @param string $es
* @param string $fr
* @param string $ja
* @param string $ko
* @param string|null $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 {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toDe(): ?string {
if (Description::validateDe($this->de)) {
if (!is_null($this->de)) {
return $this->de; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::de');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateDe(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::de");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getDe(): ?string {
if (Description::validateDe($this->de)) {
return $this->de;
}
throw new Exception('never get to getDe Description::de');
}
/**
* @return ?string
*/
public static function sampleDe(): ?string {
return 'Description::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 (Description::validateEn($this->en)) {
return $this->en; /*string*/
}
throw new Exception('never get to this Description::en');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEn(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::en");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEn(): string {
if (Description::validateEn($this->en)) {
return $this->en;
}
throw new Exception('never get to getEn Description::en');
}
/**
* @return string
*/
public static function sampleEn(): string {
return 'Description::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 (Description::validateEs($this->es)) {
return $this->es; /*string*/
}
throw new Exception('never get to this Description::es');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEs(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::es");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEs(): string {
if (Description::validateEs($this->es)) {
return $this->es;
}
throw new Exception('never get to getEs Description::es');
}
/**
* @return string
*/
public static function sampleEs(): string {
return 'Description::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 (Description::validateFr($this->fr)) {
return $this->fr; /*string*/
}
throw new Exception('never get to this Description::fr');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateFr(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::fr");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getFr(): string {
if (Description::validateFr($this->fr)) {
return $this->fr;
}
throw new Exception('never get to getFr Description::fr');
}
/**
* @return string
*/
public static function sampleFr(): string {
return 'Description::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 (Description::validateJa($this->ja)) {
return $this->ja; /*string*/
}
throw new Exception('never get to this Description::ja');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateJa(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ja");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getJa(): string {
if (Description::validateJa($this->ja)) {
return $this->ja;
}
throw new Exception('never get to getJa Description::ja');
}
/**
* @return string
*/
public static function sampleJa(): string {
return 'Description::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 (Description::validateKo($this->ko)) {
return $this->ko; /*string*/
}
throw new Exception('never get to this Description::ko');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateKo(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ko");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getKo(): string {
if (Description::validateKo($this->ko)) {
return $this->ko;
}
throw new Exception('never get to getKo Description::ko');
}
/**
* @return string
*/
public static function sampleKo(): string {
return 'Description::ko::36'; /*36:ko*/
}
/**
* @param ?string $value
* @throws Exception
* @return ?string
*/
public static function fromRu(?string $value): ?string {
if (!is_null($value)) {
return $value; /*string*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?string
*/
public function toRu(): ?string {
if (Description::validateRu($this->ru)) {
if (!is_null($this->ru)) {
return $this->ru; /*string*/
} else {
return null;
}
}
throw new Exception('never get to this Description::ru');
}
/**
* @param string|null
* @return bool
* @throws Exception
*/
public static function validateRu(?string $value): bool {
if (!is_null($value)) {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::ru");
}
}
return true;
}
/**
* @throws Exception
* @return ?string
*/
public function getRu(): ?string {
if (Description::validateRu($this->ru)) {
return $this->ru;
}
throw new Exception('never get to getRu Description::ru');
}
/**
* @return ?string
*/
public static function sampleRu(): ?string {
return 'Description::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 (Description::validateZh($this->zh)) {
return $this->zh; /*string*/
}
throw new Exception('never get to this Description::zh');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateZh(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Description::zh");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getZh(): string {
if (Description::validateZh($this->zh)) {
return $this->zh;
}
throw new Exception('never get to getZh Description::zh');
}
/**
* @return string
*/
public static function sampleZh(): string {
return 'Description::zh::38'; /*38:zh*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Description::validateDe($this->de)
|| Description::validateEn($this->en)
|| Description::validateEs($this->es)
|| Description::validateFr($this->fr)
|| Description::validateJa($this->ja)
|| Description::validateKo($this->ko)
|| Description::validateRu($this->ru)
|| Description::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 Description
* @throws Exception
*/
public static function from(stdClass $obj): Description {
return new Description(
Description::fromDe($obj->{'de'})
,Description::fromEn($obj->{'en'})
,Description::fromEs($obj->{'es'})
,Description::fromFr($obj->{'fr'})
,Description::fromJa($obj->{'ja'})
,Description::fromKo($obj->{'ko'})
,Description::fromRu($obj->{'ru'})
,Description::fromZh($obj->{'zh'})
);
}
/**
* @return Description
*/
public static function sample(): Description {
return new Description(
Description::sampleDe()
,Description::sampleEn()
,Description::sampleEs()
,Description::sampleFr()
,Description::sampleJa()
,Description::sampleKo()
,Description::sampleRu()
,Description::sampleZh()
);
}
}
// This is a autogenerated file:Division
class Division {
private int $key; // json:_key Required
private int $divisionNumber; // json:divisionNumber Required
private int $leaderId; // json:leaderID Required
private int $size; // json:size Required
/**
* @param int $key
* @param int $divisionNumber
* @param int $leaderId
* @param int $size
*/
public function __construct(int $key, int $divisionNumber, int $leaderId, int $size) {
$this->key = $key;
$this->divisionNumber = $divisionNumber;
$this->leaderId = $leaderId;
$this->size = $size;
}
/**
* @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 (Division::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this Division::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Division::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (Division::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey Division::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromDivisionNumber(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toDivisionNumber(): int {
if (Division::validateDivisionNumber($this->divisionNumber)) {
return $this->divisionNumber; /*int*/
}
throw new Exception('never get to this Division::divisionNumber');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateDivisionNumber(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Division::divisionNumber");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getDivisionNumber(): int {
if (Division::validateDivisionNumber($this->divisionNumber)) {
return $this->divisionNumber;
}
throw new Exception('never get to getDivisionNumber Division::divisionNumber');
}
/**
* @return int
*/
public static function sampleDivisionNumber(): int {
return 32; /*32:divisionNumber*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromLeaderId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toLeaderId(): int {
if (Division::validateLeaderId($this->leaderId)) {
return $this->leaderId; /*int*/
}
throw new Exception('never get to this Division::leaderId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateLeaderId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Division::leaderId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getLeaderId(): int {
if (Division::validateLeaderId($this->leaderId)) {
return $this->leaderId;
}
throw new Exception('never get to getLeaderId Division::leaderId');
}
/**
* @return int
*/
public static function sampleLeaderId(): int {
return 33; /*33:leaderId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromSize(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toSize(): int {
if (Division::validateSize($this->size)) {
return $this->size; /*int*/
}
throw new Exception('never get to this Division::size');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateSize(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Division::size");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getSize(): int {
if (Division::validateSize($this->size)) {
return $this->size;
}
throw new Exception('never get to getSize Division::size');
}
/**
* @return int
*/
public static function sampleSize(): int {
return 34; /*34:size*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Division::validateKey($this->key)
|| Division::validateDivisionNumber($this->divisionNumber)
|| Division::validateLeaderId($this->leaderId)
|| Division::validateSize($this->size);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'divisionNumber'} = $this->toDivisionNumber();
$out->{'leaderID'} = $this->toLeaderId();
$out->{'size'} = $this->toSize();
return $out;
}
/**
* @param stdClass $obj
* @return Division
* @throws Exception
*/
public static function from(stdClass $obj): Division {
return new Division(
Division::fromKey($obj->{'_key'})
,Division::fromDivisionNumber($obj->{'divisionNumber'})
,Division::fromLeaderId($obj->{'leaderID'})
,Division::fromSize($obj->{'size'})
);
}
/**
* @return Division
*/
public static function sample(): Division {
return new Division(
Division::sampleKey()
,Division::sampleDivisionNumber()
,Division::sampleLeaderId()
,Division::sampleSize()
);
}
}
// This is a autogenerated file:ExchangeRate
class ExchangeRate {
private int $key; // json:_key Required
private float $value; // json:_value Required
/**
* @param int $key
* @param float $value
*/
public function __construct(int $key, float $value) {
$this->key = $key;
$this->value = $value;
}
/**
* @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 (ExchangeRate::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this ExchangeRate::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:ExchangeRate::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (ExchangeRate::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey ExchangeRate::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromValue(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toValue(): float {
if (ExchangeRate::validateValue($this->value)) {
return $this->value; /*float*/
}
throw new Exception('never get to this ExchangeRate::value');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateValue(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:ExchangeRate::value");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getValue(): float {
if (ExchangeRate::validateValue($this->value)) {
return $this->value;
}
throw new Exception('never get to getValue ExchangeRate::value');
}
/**
* @return float
*/
public static function sampleValue(): float {
return 32.032; /*32:value*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return ExchangeRate::validateKey($this->key)
|| ExchangeRate::validateValue($this->value);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'_value'} = $this->toValue();
return $out;
}
/**
* @param stdClass $obj
* @return ExchangeRate
* @throws Exception
*/
public static function from(stdClass $obj): ExchangeRate {
return new ExchangeRate(
ExchangeRate::fromKey($obj->{'_key'})
,ExchangeRate::fromValue($obj->{'_value'})
);
}
/**
* @return ExchangeRate
*/
public static function sample(): ExchangeRate {
return new ExchangeRate(
ExchangeRate::sampleKey()
,ExchangeRate::sampleValue()
);
}
}
// This is a autogenerated file:Extent
class Extent {
public static Extent $C;
public static Extent $G;
public static Extent $L;
public static Extent $N;
public static Extent $R;
public static function init() {
Extent::$C = new Extent('C');
Extent::$G = new Extent('G');
Extent::$L = new Extent('L');
Extent::$N = new Extent('N');
Extent::$R = new Extent('R');
}
private string $enum;
public function __construct(string $enum) {
$this->enum = $enum;
}
/**
* @param Extent
* @return string
* @throws Exception
*/
public static function to(Extent $obj): string {
switch ($obj->enum) {
case Extent::$C->enum: return 'C';
case Extent::$G->enum: return 'G';
case Extent::$L->enum: return 'L';
case Extent::$N->enum: return 'N';
case Extent::$R->enum: return 'R';
}
throw new Exception('the give value is not an enum-value.');
}
/**
* @param mixed
* @return Extent
* @throws Exception
*/
public static function from($obj): Extent {
switch ($obj) {
case 'C': return Extent::$C;
case 'G': return Extent::$G;
case 'L': return Extent::$L;
case 'N': return Extent::$N;
case 'R': return Extent::$R;
}
throw new Exception("Cannot deserialize Extent");
}
/**
* @return Extent
*/
public static function sample(): Extent {
return Extent::$C;
}
}
Extent::init();
// This is a autogenerated file:Investor
class Investor {
private int $key; // json:_key Required
private int $value; // json:_value Required
/**
* @param int $key
* @param int $value
*/
public function __construct(int $key, int $value) {
$this->key = $key;
$this->value = $value;
}
/**
* @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 (Investor::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this Investor::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Investor::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (Investor::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey Investor::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromValue(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toValue(): int {
if (Investor::validateValue($this->value)) {
return $this->value; /*int*/
}
throw new Exception('never get to this Investor::value');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateValue(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Investor::value");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getValue(): int {
if (Investor::validateValue($this->value)) {
return $this->value;
}
throw new Exception('never get to getValue Investor::value');
}
/**
* @return int
*/
public static function sampleValue(): int {
return 32; /*32:value*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Investor::validateKey($this->key)
|| Investor::validateValue($this->value);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'_value'} = $this->toValue();
return $out;
}
/**
* @param stdClass $obj
* @return Investor
* @throws Exception
*/
public static function from(stdClass $obj): Investor {
return new Investor(
Investor::fromKey($obj->{'_key'})
,Investor::fromValue($obj->{'_value'})
);
}
/**
* @return Investor
*/
public static function sample(): Investor {
return new Investor(
Investor::sampleKey()
,Investor::sampleValue()
);
}
}
// 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:Size
class Size {
public static Size $H;
public static Size $L;
public static Size $M;
public static Size $S;
public static Size $T;
public static function init() {
Size::$H = new Size('H');
Size::$L = new Size('L');
Size::$M = new Size('M');
Size::$S = new Size('S');
Size::$T = new Size('T');
}
private string $enum;
public function __construct(string $enum) {
$this->enum = $enum;
}
/**
* @param Size
* @return string
* @throws Exception
*/
public static function to(Size $obj): string {
switch ($obj->enum) {
case Size::$H->enum: return 'H';
case Size::$L->enum: return 'L';
case Size::$M->enum: return 'M';
case Size::$S->enum: return 'S';
case Size::$T->enum: return 'T';
}
throw new Exception('the give value is not an enum-value.');
}
/**
* @param mixed
* @return Size
* @throws Exception
*/
public static function from($obj): Size {
switch ($obj) {
case 'H': return Size::$H;
case 'L': return Size::$L;
case 'M': return Size::$M;
case 'S': return Size::$S;
case 'T': return Size::$T;
}
throw new Exception("Cannot deserialize Size");
}
/**
* @return Size
*/
public static function sample(): Size {
return Size::$H;
}
}
Size::init();
from typing import Any, Optional, List, TypeVar, Callable, Type, cast
from enum import Enum
T = TypeVar("T")
EnumT = TypeVar("EnumT", bound=Enum)
def from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
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_str(x: Any) -> str:
assert isinstance(x, str)
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 from_bool(x: Any) -> bool:
assert isinstance(x, bool)
return x
def to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
def to_enum(c: Type[EnumT], x: Any) -> EnumT:
assert isinstance(x, c)
return x.value
class CorporationTrade:
key: int
value: float
def __init__(self, key: int, value: float) -> None:
self.key = key
self.value = value
@staticmethod
def from_dict(obj: Any) -> 'CorporationTrade':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
value = from_float(obj.get("_value"))
return CorporationTrade(key, value)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["_value"] = to_float(self.value)
return result
class Description:
de: Optional[str]
en: str
es: str
fr: str
ja: str
ko: str
ru: Optional[str]
zh: str
def __init__(self, de: Optional[str], en: str, es: str, fr: str, ja: str, ko: str, ru: Optional[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) -> 'Description':
assert isinstance(obj, dict)
de = from_union([from_str, from_none], 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_union([from_str, from_none], obj.get("ru"))
zh = from_str(obj.get("zh"))
return Description(de, en, es, fr, ja, ko, ru, zh)
def to_dict(self) -> dict:
result: dict = {}
if self.de is not None:
result["de"] = from_union([from_str, from_none], 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)
if self.ru is not None:
result["ru"] = from_union([from_str, from_none], self.ru)
result["zh"] = from_str(self.zh)
return result
class Division:
key: int
division_number: int
leader_id: int
size: int
def __init__(self, key: int, division_number: int, leader_id: int, size: int) -> None:
self.key = key
self.division_number = division_number
self.leader_id = leader_id
self.size = size
@staticmethod
def from_dict(obj: Any) -> 'Division':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
division_number = from_int(obj.get("divisionNumber"))
leader_id = from_int(obj.get("leaderID"))
size = from_int(obj.get("size"))
return Division(key, division_number, leader_id, size)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["divisionNumber"] = from_int(self.division_number)
result["leaderID"] = from_int(self.leader_id)
result["size"] = from_int(self.size)
return result
class ExchangeRate:
key: int
value: float
def __init__(self, key: int, value: float) -> None:
self.key = key
self.value = value
@staticmethod
def from_dict(obj: Any) -> 'ExchangeRate':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
value = from_float(obj.get("_value"))
return ExchangeRate(key, value)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["_value"] = to_float(self.value)
return result
class Extent(Enum):
C = "C"
G = "G"
L = "L"
N = "N"
R = "R"
class Investor:
key: int
value: int
def __init__(self, key: int, value: int) -> None:
self.key = key
self.value = value
@staticmethod
def from_dict(obj: Any) -> 'Investor':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
value = from_int(obj.get("_value"))
return Investor(key, value)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["_value"] = from_int(self.value)
return result
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 Size(Enum):
H = "H"
L = "L"
M = "M"
S = "S"
T = "T"
class NpcCorporation:
key: int
allowed_member_races: Optional[List[int]]
ceo_id: Optional[int]
corporation_trades: Optional[List[CorporationTrade]]
deleted: bool
description: Optional[Description]
divisions: Optional[List[Division]]
enemy_id: Optional[int]
exchange_rates: Optional[List[ExchangeRate]]
extent: Extent
faction_id: Optional[int]
friend_id: Optional[int]
has_player_personnel_manager: bool
icon_id: Optional[int]
initial_price: int
investors: Optional[List[Investor]]
lp_offer_tables: Optional[List[int]]
main_activity_id: Optional[int]
member_limit: int
minimum_join_standing: int
min_security: float
name: Name
race_id: Optional[int]
secondary_activity_id: Optional[int]
send_char_termination_message: bool
shares: int
size: Size
size_factor: Optional[float]
solar_system_id: Optional[int]
station_id: Optional[int]
tax_rate: float
ticker_name: str
unique_name: bool
def __init__(self, key: int, allowed_member_races: Optional[List[int]], ceo_id: Optional[int], corporation_trades: Optional[List[CorporationTrade]], deleted: bool, description: Optional[Description], divisions: Optional[List[Division]], enemy_id: Optional[int], exchange_rates: Optional[List[ExchangeRate]], extent: Extent, faction_id: Optional[int], friend_id: Optional[int], has_player_personnel_manager: bool, icon_id: Optional[int], initial_price: int, investors: Optional[List[Investor]], lp_offer_tables: Optional[List[int]], main_activity_id: Optional[int], member_limit: int, minimum_join_standing: int, min_security: float, name: Name, race_id: Optional[int], secondary_activity_id: Optional[int], send_char_termination_message: bool, shares: int, size: Size, size_factor: Optional[float], solar_system_id: Optional[int], station_id: Optional[int], tax_rate: float, ticker_name: str, unique_name: bool) -> None:
self.key = key
self.allowed_member_races = allowed_member_races
self.ceo_id = ceo_id
self.corporation_trades = corporation_trades
self.deleted = deleted
self.description = description
self.divisions = divisions
self.enemy_id = enemy_id
self.exchange_rates = exchange_rates
self.extent = extent
self.faction_id = faction_id
self.friend_id = friend_id
self.has_player_personnel_manager = has_player_personnel_manager
self.icon_id = icon_id
self.initial_price = initial_price
self.investors = investors
self.lp_offer_tables = lp_offer_tables
self.main_activity_id = main_activity_id
self.member_limit = member_limit
self.minimum_join_standing = minimum_join_standing
self.min_security = min_security
self.name = name
self.race_id = race_id
self.secondary_activity_id = secondary_activity_id
self.send_char_termination_message = send_char_termination_message
self.shares = shares
self.size = size
self.size_factor = size_factor
self.solar_system_id = solar_system_id
self.station_id = station_id
self.tax_rate = tax_rate
self.ticker_name = ticker_name
self.unique_name = unique_name
@staticmethod
def from_dict(obj: Any) -> 'NpcCorporation':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
allowed_member_races = from_union([lambda x: from_list(from_int, x), from_none], obj.get("allowedMemberRaces"))
ceo_id = from_union([from_int, from_none], obj.get("ceoID"))
corporation_trades = from_union([lambda x: from_list(CorporationTrade.from_dict, x), from_none], obj.get("corporationTrades"))
deleted = from_bool(obj.get("deleted"))
description = from_union([Description.from_dict, from_none], obj.get("description"))
divisions = from_union([lambda x: from_list(Division.from_dict, x), from_none], obj.get("divisions"))
enemy_id = from_union([from_int, from_none], obj.get("enemyID"))
exchange_rates = from_union([lambda x: from_list(ExchangeRate.from_dict, x), from_none], obj.get("exchangeRates"))
extent = Extent(obj.get("extent"))
faction_id = from_union([from_int, from_none], obj.get("factionID"))
friend_id = from_union([from_int, from_none], obj.get("friendID"))
has_player_personnel_manager = from_bool(obj.get("hasPlayerPersonnelManager"))
icon_id = from_union([from_int, from_none], obj.get("iconID"))
initial_price = from_int(obj.get("initialPrice"))
investors = from_union([lambda x: from_list(Investor.from_dict, x), from_none], obj.get("investors"))
lp_offer_tables = from_union([lambda x: from_list(from_int, x), from_none], obj.get("lpOfferTables"))
main_activity_id = from_union([from_int, from_none], obj.get("mainActivityID"))
member_limit = from_int(obj.get("memberLimit"))
minimum_join_standing = from_int(obj.get("minimumJoinStanding"))
min_security = from_float(obj.get("minSecurity"))
name = Name.from_dict(obj.get("name"))
race_id = from_union([from_int, from_none], obj.get("raceID"))
secondary_activity_id = from_union([from_int, from_none], obj.get("secondaryActivityID"))
send_char_termination_message = from_bool(obj.get("sendCharTerminationMessage"))
shares = from_int(obj.get("shares"))
size = Size(obj.get("size"))
size_factor = from_union([from_float, from_none], obj.get("sizeFactor"))
solar_system_id = from_union([from_int, from_none], obj.get("solarSystemID"))
station_id = from_union([from_int, from_none], obj.get("stationID"))
tax_rate = from_float(obj.get("taxRate"))
ticker_name = from_str(obj.get("tickerName"))
unique_name = from_bool(obj.get("uniqueName"))
return NpcCorporation(key, allowed_member_races, ceo_id, corporation_trades, deleted, description, divisions, enemy_id, exchange_rates, extent, faction_id, friend_id, has_player_personnel_manager, icon_id, initial_price, investors, lp_offer_tables, main_activity_id, member_limit, minimum_join_standing, min_security, name, race_id, secondary_activity_id, send_char_termination_message, shares, size, size_factor, solar_system_id, station_id, tax_rate, ticker_name, unique_name)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
if self.allowed_member_races is not None:
result["allowedMemberRaces"] = from_union([lambda x: from_list(from_int, x), from_none], self.allowed_member_races)
if self.ceo_id is not None:
result["ceoID"] = from_union([from_int, from_none], self.ceo_id)
if self.corporation_trades is not None:
result["corporationTrades"] = from_union([lambda x: from_list(lambda x: to_class(CorporationTrade, x), x), from_none], self.corporation_trades)
result["deleted"] = from_bool(self.deleted)
if self.description is not None:
result["description"] = from_union([lambda x: to_class(Description, x), from_none], self.description)
if self.divisions is not None:
result["divisions"] = from_union([lambda x: from_list(lambda x: to_class(Division, x), x), from_none], self.divisions)
if self.enemy_id is not None:
result["enemyID"] = from_union([from_int, from_none], self.enemy_id)
if self.exchange_rates is not None:
result["exchangeRates"] = from_union([lambda x: from_list(lambda x: to_class(ExchangeRate, x), x), from_none], self.exchange_rates)
result["extent"] = to_enum(Extent, self.extent)
if self.faction_id is not None:
result["factionID"] = from_union([from_int, from_none], self.faction_id)
if self.friend_id is not None:
result["friendID"] = from_union([from_int, from_none], self.friend_id)
result["hasPlayerPersonnelManager"] = from_bool(self.has_player_personnel_manager)
if self.icon_id is not None:
result["iconID"] = from_union([from_int, from_none], self.icon_id)
result["initialPrice"] = from_int(self.initial_price)
if self.investors is not None:
result["investors"] = from_union([lambda x: from_list(lambda x: to_class(Investor, x), x), from_none], self.investors)
if self.lp_offer_tables is not None:
result["lpOfferTables"] = from_union([lambda x: from_list(from_int, x), from_none], self.lp_offer_tables)
if self.main_activity_id is not None:
result["mainActivityID"] = from_union([from_int, from_none], self.main_activity_id)
result["memberLimit"] = from_int(self.member_limit)
result["minimumJoinStanding"] = from_int(self.minimum_join_standing)
result["minSecurity"] = to_float(self.min_security)
result["name"] = to_class(Name, self.name)
if self.race_id is not None:
result["raceID"] = from_union([from_int, from_none], self.race_id)
if self.secondary_activity_id is not None:
result["secondaryActivityID"] = from_union([from_int, from_none], self.secondary_activity_id)
result["sendCharTerminationMessage"] = from_bool(self.send_char_termination_message)
result["shares"] = from_int(self.shares)
result["size"] = to_enum(Size, self.size)
if self.size_factor is not None:
result["sizeFactor"] = from_union([to_float, from_none], self.size_factor)
if self.solar_system_id is not None:
result["solarSystemID"] = from_union([from_int, from_none], self.solar_system_id)
if self.station_id is not None:
result["stationID"] = from_union([from_int, from_none], self.station_id)
result["taxRate"] = to_float(self.tax_rate)
result["tickerName"] = from_str(self.ticker_name)
result["uniqueName"] = from_bool(self.unique_name)
return result
def npc_corporation_from_dict(s: Any) -> NpcCorporation:
return NpcCorporation.from_dict(s)
def npc_corporation_to_dict(x: NpcCorporation) -> Any:
return to_class(NpcCorporation, x)
// To parse this data:
//
// import { Convert, NpcCorporation } from "./file";
//
// const npcCorporation = Convert.toNpcCorporation(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface NpcCorporation {
_key: number;
allowedMemberRaces?: number[];
ceoID?: number;
corporationTrades?: CorporationTrade[];
deleted: boolean;
description?: Description;
divisions?: Division[];
enemyID?: number;
exchangeRates?: ExchangeRate[];
extent: Extent;
factionID?: number;
friendID?: number;
hasPlayerPersonnelManager: boolean;
iconID?: number;
initialPrice: number;
investors?: Investor[];
lpOfferTables?: number[];
mainActivityID?: number;
memberLimit: number;
minimumJoinStanding: number;
minSecurity: number;
name: Name;
raceID?: number;
secondaryActivityID?: number;
sendCharTerminationMessage: boolean;
shares: number;
size: Size;
sizeFactor?: number;
solarSystemID?: number;
stationID?: number;
taxRate: number;
tickerName: string;
uniqueName: boolean;
[property: string]: any;
}
export interface CorporationTrade {
_key: number;
_value: number;
[property: string]: any;
}
export interface Description {
de?: string;
en: string;
es: string;
fr: string;
ja: string;
ko: string;
ru?: string;
zh: string;
[property: string]: any;
}
export interface Division {
_key: number;
divisionNumber: number;
leaderID: number;
size: number;
[property: string]: any;
}
export interface ExchangeRate {
_key: number;
_value: number;
[property: string]: any;
}
export enum Extent {
C = "C",
G = "G",
L = "L",
N = "N",
R = "R",
}
export interface Investor {
_key: number;
_value: 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 enum Size {
H = "H",
L = "L",
M = "M",
S = "S",
T = "T",
}
// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
public static toNpcCorporation(json: string): NpcCorporation {
return cast(JSON.parse(json), r("NpcCorporation"));
}
public static npcCorporationToJson(value: NpcCorporation): string {
return JSON.stringify(uncast(value, r("NpcCorporation")), 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 = {
"NpcCorporation": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "allowedMemberRaces", js: "allowedMemberRaces", typ: u(undefined, a(0)) },
{ json: "ceoID", js: "ceoID", typ: u(undefined, 0) },
{ json: "corporationTrades", js: "corporationTrades", typ: u(undefined, a(r("CorporationTrade"))) },
{ json: "deleted", js: "deleted", typ: true },
{ json: "description", js: "description", typ: u(undefined, r("Description")) },
{ json: "divisions", js: "divisions", typ: u(undefined, a(r("Division"))) },
{ json: "enemyID", js: "enemyID", typ: u(undefined, 0) },
{ json: "exchangeRates", js: "exchangeRates", typ: u(undefined, a(r("ExchangeRate"))) },
{ json: "extent", js: "extent", typ: r("Extent") },
{ json: "factionID", js: "factionID", typ: u(undefined, 0) },
{ json: "friendID", js: "friendID", typ: u(undefined, 0) },
{ json: "hasPlayerPersonnelManager", js: "hasPlayerPersonnelManager", typ: true },
{ json: "iconID", js: "iconID", typ: u(undefined, 0) },
{ json: "initialPrice", js: "initialPrice", typ: 0 },
{ json: "investors", js: "investors", typ: u(undefined, a(r("Investor"))) },
{ json: "lpOfferTables", js: "lpOfferTables", typ: u(undefined, a(0)) },
{ json: "mainActivityID", js: "mainActivityID", typ: u(undefined, 0) },
{ json: "memberLimit", js: "memberLimit", typ: 0 },
{ json: "minimumJoinStanding", js: "minimumJoinStanding", typ: 0 },
{ json: "minSecurity", js: "minSecurity", typ: 3.14 },
{ json: "name", js: "name", typ: r("Name") },
{ json: "raceID", js: "raceID", typ: u(undefined, 0) },
{ json: "secondaryActivityID", js: "secondaryActivityID", typ: u(undefined, 0) },
{ json: "sendCharTerminationMessage", js: "sendCharTerminationMessage", typ: true },
{ json: "shares", js: "shares", typ: 0 },
{ json: "size", js: "size", typ: r("Size") },
{ json: "sizeFactor", js: "sizeFactor", typ: u(undefined, 3.14) },
{ json: "solarSystemID", js: "solarSystemID", typ: u(undefined, 0) },
{ json: "stationID", js: "stationID", typ: u(undefined, 0) },
{ json: "taxRate", js: "taxRate", typ: 3.14 },
{ json: "tickerName", js: "tickerName", typ: "" },
{ json: "uniqueName", js: "uniqueName", typ: true },
], "any"),
"CorporationTrade": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "_value", js: "_value", typ: 3.14 },
], "any"),
"Description": o([
{ json: "de", js: "de", typ: u(undefined, "") },
{ 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: u(undefined, "") },
{ json: "zh", js: "zh", typ: "" },
], "any"),
"Division": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "divisionNumber", js: "divisionNumber", typ: 0 },
{ json: "leaderID", js: "leaderID", typ: 0 },
{ json: "size", js: "size", typ: 0 },
], "any"),
"ExchangeRate": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "_value", js: "_value", typ: 3.14 },
], "any"),
"Investor": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "_value", js: "_value", typ: 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"),
"Extent": [
"C",
"G",
"L",
"N",
"R",
],
"Size": [
"H",
"L",
"M",
"S",
"T",
],
};