Skip to content

EVE SDE Schema

Documentation for third-party developers

epicArcs.jsonl

Schema

  • _key (required): integer
    Range: 29 .. 132
  • arcRestartInterval (required): integer
    Range: 1 .. 129600
  • factionID: integer
    Range: 500001 .. 500028
  • iconID (required): integer
    Range: 1271 .. 25092
  • missions (required): array of object

    • _key (required): integer
      Range: 14117 .. 17190
    • agentID (required): integer
      Range: 3019356 .. 3020237
    • failMissionID: integer
      Range: 14118 .. 15662
    • nextMissions: array of integer
      Type: integer
      Range: 14118 .. 17190
  • name (required): object

    • de (required): string
    • en (required): string
    • es (required): string
    • fr (required): string
    • ja (required): string
    • ko (required): string
    • ru (required): string
    • zh (required): string

Code snippets

// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
//    using QuickType;
//
//    var epicArc = EpicArc.FromJson(jsonString);

namespace QuickType
{
    using System;
    using System.Collections.Generic;

    using System.Globalization;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Converters;

    public partial class EpicArc
    {
        [JsonProperty("_key")]
        public long Key { get; set; }

        [JsonProperty("arcRestartInterval")]
        public long ArcRestartInterval { get; set; }

        [JsonProperty("factionID", NullValueHandling = NullValueHandling.Ignore)]
        public long? FactionId { get; set; }

        [JsonProperty("iconID")]
        public long IconId { get; set; }

        [JsonProperty("missions")]
        public Mission[] Missions { get; set; }

        [JsonProperty("name")]
        public Name Name { get; set; }
    }

    public partial class Mission
    {
        [JsonProperty("_key")]
        public long Key { get; set; }

        [JsonProperty("agentID")]
        public long AgentId { get; set; }

        [JsonProperty("failMissionID", NullValueHandling = NullValueHandling.Ignore)]
        public long? FailMissionId { get; set; }

        [JsonProperty("nextMissions", NullValueHandling = NullValueHandling.Ignore)]
        public long[] NextMissions { get; set; }
    }

    public partial class Name
    {
        [JsonProperty("de")]
        [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")]
        [JsonConverter(typeof(HilariousMinMaxLengthCheckConverter))]
        public string Ru { get; set; }

        [JsonProperty("zh")]
        [JsonConverter(typeof(AmbitiousMinMaxLengthCheckConverter))]
        public string Zh { get; set; }
    }

    public partial class EpicArc
    {
        public static EpicArc FromJson(string json) => JsonConvert.DeserializeObject<EpicArc>(json, QuickType.Converter.Settings);
    }

    public static class Serialize
    {
        public static string ToJson(this EpicArc self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings);
    }

    internal static class Converter
    {
        public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
        {
            MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
            DateParseHandling = DateParseHandling.None,
            Converters =
            {
                new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
            },
        };
    }

    internal class 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 >= 9 && value.Length <= 39)
            {
                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 >= 9 && value.Length <= 39)
            {
                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 >= 8 && value.Length <= 39)
            {
                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 >= 8 && value.Length <= 39)
            {
                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 >= 8 && value.Length <= 44)
            {
                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 >= 8 && value.Length <= 44)
            {
                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 >= 8 && value.Length <= 33)
            {
                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 >= 8 && value.Length <= 33)
            {
                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 >= 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 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 >= 2 && value.Length <= 18)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            var value = (string)untypedValue;
            if (value.Length >= 2 && value.Length <= 18)
            {
                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 >= 16 && value.Length <= 43)
            {
                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 >= 16 && value.Length <= 43)
            {
                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 >= 2 && value.Length <= 14)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            var value = (string)untypedValue;
            if (value.Length >= 2 && value.Length <= 14)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

        public static readonly AmbitiousMinMaxLengthCheckConverter Singleton = new AmbitiousMinMaxLengthCheckConverter();
    }
}
// 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:
//
//    epicArc, err := UnmarshalEpicArc(bytes)
//    bytes, err = epicArc.Marshal()

package model

import "encoding/json"

func UnmarshalEpicArc(data []byte) (EpicArc, error) {
    var r EpicArc
    err := json.Unmarshal(data, &r)
    return r, err
}

func (r *EpicArc) Marshal() ([]byte, error) {
    return json.Marshal(r)
}

type EpicArc struct {
    Key                int64     `json:"_key"`
    ArcRestartInterval int64     `json:"arcRestartInterval"`
    FactionID          *int64    `json:"factionID,omitempty"`
    IconID             int64     `json:"iconID"`
    Missions           []Mission `json:"missions"`
    Name               Name      `json:"name"`
}

type Mission struct {
    Key           int64   `json:"_key"`
    AgentID       int64   `json:"agentID"`
    FailMissionID *int64  `json:"failMissionID,omitempty"`
    NextMissions  []int64 `json:"nextMissions,omitempty"`
}

type Name struct {
    De string `json:"de"`
    En string `json:"en"`
    Es string `json:"es"`
    Fr string `json:"fr"`
    Ja string `json:"ja"`
    Ko string `json:"ko"`
    Ru string `json:"ru"`
    Zh string `json:"zh"`
}
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"_key":{"type":"integer","minimum":29,"maximum":132},"arcRestartInterval":{"type":"integer","minimum":1,"maximum":129600},"factionID":{"type":"integer","minimum":500001,"maximum":500028},"iconID":{"type":"integer","minimum":1271,"maximum":25092},"missions":{"type":"array","items":{"type":"object","properties":{"_key":{"type":"integer","minimum":14117,"maximum":17190},"agentID":{"type":"integer","minimum":3019356,"maximum":3020237},"failMissionID":{"type":"integer","minimum":14118,"maximum":15662},"nextMissions":{"type":"array","items":{"type":"integer","minimum":14118,"maximum":17190},"minItems":1,"maxItems":4}},"required":["_key","agentID"]},"minItems":3,"maxItems":64},"name":{"type":"object","properties":{"de":{"type":"string","minLength":9,"maxLength":39},"en":{"type":"string","minLength":8,"maxLength":39},"es":{"type":"string","minLength":8,"maxLength":44},"fr":{"type":"string","minLength":8,"maxLength":33},"ja":{"type":"string","minLength":3,"maxLength":19},"ko":{"type":"string","minLength":2,"maxLength":18},"ru":{"type":"string","minLength":16,"maxLength":43},"zh":{"type":"string","minLength":2,"maxLength":14}},"required":["de","en","es","fr","ja","ko","ru","zh"]}},"required":["_key","arcRestartInterval","iconID","missions","name"]}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json    = Json { allowStructuredMapKeys = true }
// val epicArc = json.parse(EpicArc.serializer(), jsonString)

package model

import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*

@Serializable
data class EpicArc (
    @SerialName("_key")
    val key: Long,

    val arcRestartInterval: Long,

    @SerialName("factionID")
    val factionId: Long? = null,

    @SerialName("iconID")
    val iconId: Long,

    val missions: List<Mission>,
    val name: Name
)

@Serializable
data class Mission (
    @SerialName("_key")
    val key: Long,

    @SerialName("agentID")
    val agentId: Long,

    @SerialName("failMissionID")
    val failMissionId: Long? = null,

    val nextMissions: List<Long>? = null
)

@Serializable
data class Name (
    val de: String,
    val en: String,
    val es: String,
    val fr: String,
    val ja: String,
    val ko: String,
    val ru: String,
    val zh: String
)
<?php

// This is a autogenerated file:EpicArc

class EpicArc {
    private int $key; // json:_key Required
    private int $arcRestartInterval; // json:arcRestartInterval Required
    private ?int $factionId; // json:factionID Optional
    private int $iconId; // json:iconID Required
    private array $missions; // json:missions Required
    private Name $name; // json:name Required

    /**
     * @param int $key
     * @param int $arcRestartInterval
     * @param int|null $factionId
     * @param int $iconId
     * @param array $missions
     * @param Name $name
     */
    public function __construct(int $key, int $arcRestartInterval, ?int $factionId, int $iconId, array $missions, Name $name) {
        $this->key = $key;
        $this->arcRestartInterval = $arcRestartInterval;
        $this->factionId = $factionId;
        $this->iconId = $iconId;
        $this->missions = $missions;
        $this->name = $name;
    }

    /**
     * @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 (EpicArc::validateKey($this->key))  {
            return $this->key; /*int*/
        }
        throw new Exception('never get to this EpicArc::key');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateKey(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:EpicArc::key");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getKey(): int {
        if (EpicArc::validateKey($this->key))  {
            return $this->key;
        }
        throw new Exception('never get to getKey EpicArc::key');
    }

    /**
     * @return int
     */
    public static function sampleKey(): int {
        return 31; /*31:key*/
    }

    /**
     * @param int $value
     * @throws Exception
     * @return int
     */
    public static function fromArcRestartInterval(int $value): int {
        return $value; /*int*/
    }

    /**
     * @throws Exception
     * @return int
     */
    public function toArcRestartInterval(): int {
        if (EpicArc::validateArcRestartInterval($this->arcRestartInterval))  {
            return $this->arcRestartInterval; /*int*/
        }
        throw new Exception('never get to this EpicArc::arcRestartInterval');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateArcRestartInterval(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:EpicArc::arcRestartInterval");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getArcRestartInterval(): int {
        if (EpicArc::validateArcRestartInterval($this->arcRestartInterval))  {
            return $this->arcRestartInterval;
        }
        throw new Exception('never get to getArcRestartInterval EpicArc::arcRestartInterval');
    }

    /**
     * @return int
     */
    public static function sampleArcRestartInterval(): int {
        return 32; /*32:arcRestartInterval*/
    }

    /**
     * @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 (EpicArc::validateFactionId($this->factionId))  {
            if (!is_null($this->factionId)) {
                return $this->factionId; /*int*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this EpicArc::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:EpicArc::factionId");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?int
     */
    public function getFactionId(): ?int {
        if (EpicArc::validateFactionId($this->factionId))  {
            return $this->factionId;
        }
        throw new Exception('never get to getFactionId EpicArc::factionId');
    }

    /**
     * @return ?int
     */
    public static function sampleFactionId(): ?int {
        return 33; /*33:factionId*/
    }

    /**
     * @param int $value
     * @throws Exception
     * @return int
     */
    public static function fromIconId(int $value): int {
        return $value; /*int*/
    }

    /**
     * @throws Exception
     * @return int
     */
    public function toIconId(): int {
        if (EpicArc::validateIconId($this->iconId))  {
            return $this->iconId; /*int*/
        }
        throw new Exception('never get to this EpicArc::iconId');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateIconId(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:EpicArc::iconId");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getIconId(): int {
        if (EpicArc::validateIconId($this->iconId))  {
            return $this->iconId;
        }
        throw new Exception('never get to getIconId EpicArc::iconId');
    }

    /**
     * @return int
     */
    public static function sampleIconId(): int {
        return 34; /*34:iconId*/
    }

    /**
     * @param array $value
     * @throws Exception
     * @return array
     */
    public static function fromMissions(array $value): array {
        return  array_map(function ($value) {
            return Mission::from($value); /*class*/
        }, $value);
    }

    /**
     * @throws Exception
     * @return array
     */
    public function toMissions(): array {
        if (EpicArc::validateMissions($this->missions))  {
            return array_map(function ($value) {
                return $value->to(); /*class*/
            }, $this->missions);
        }
        throw new Exception('never get to this EpicArc::missions');
    }

    /**
     * @param array
     * @return bool
     * @throws Exception
     */
    public static function validateMissions(array $value): bool {
        if (!is_array($value)) {
            throw new Exception("Attribute Error:EpicArc::missions");
        }
        array_walk($value, function($value_v) {
            $value_v->validate();
        });
        return true;
    }

    /**
     * @throws Exception
     * @return array
     */
    public function getMissions(): array {
        if (EpicArc::validateMissions($this->missions))  {
            return $this->missions;
        }
        throw new Exception('never get to getMissions EpicArc::missions');
    }

    /**
     * @return array
     */
    public static function sampleMissions(): array {
        return  array(
            Mission::sample() /*35:*/
        ); /* 35:missions*/
    }

    /**
     * @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 (EpicArc::validateName($this->name))  {
            return $this->name->to(); /*class*/
        }
        throw new Exception('never get to this EpicArc::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 (EpicArc::validateName($this->name))  {
            return $this->name;
        }
        throw new Exception('never get to getName EpicArc::name');
    }

    /**
     * @return Name
     */
    public static function sampleName(): Name {
        return Name::sample(); /*36:name*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return EpicArc::validateKey($this->key)
        || EpicArc::validateArcRestartInterval($this->arcRestartInterval)
        || EpicArc::validateFactionId($this->factionId)
        || EpicArc::validateIconId($this->iconId)
        || EpicArc::validateMissions($this->missions)
        || EpicArc::validateName($this->name);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'arcRestartInterval'} = $this->toArcRestartInterval();
        $out->{'factionID'} = $this->toFactionId();
        $out->{'iconID'} = $this->toIconId();
        $out->{'missions'} = $this->toMissions();
        $out->{'name'} = $this->toName();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return EpicArc
     * @throws Exception
     */
    public static function from(stdClass $obj): EpicArc {
        return new EpicArc(
         EpicArc::fromKey($obj->{'_key'})
        ,EpicArc::fromArcRestartInterval($obj->{'arcRestartInterval'})
        ,EpicArc::fromFactionId($obj->{'factionID'})
        ,EpicArc::fromIconId($obj->{'iconID'})
        ,EpicArc::fromMissions($obj->{'missions'})
        ,EpicArc::fromName($obj->{'name'})
        );
    }

    /**
     * @return EpicArc
     */
    public static function sample(): EpicArc {
        return new EpicArc(
         EpicArc::sampleKey()
        ,EpicArc::sampleArcRestartInterval()
        ,EpicArc::sampleFactionId()
        ,EpicArc::sampleIconId()
        ,EpicArc::sampleMissions()
        ,EpicArc::sampleName()
        );
    }
}

// This is a autogenerated file:Mission

class Mission {
    private int $key; // json:_key Required
    private int $agentId; // json:agentID Required
    private ?int $failMissionId; // json:failMissionID Optional
    private ?array $nextMissions; // json:nextMissions Optional

    /**
     * @param int $key
     * @param int $agentId
     * @param int|null $failMissionId
     * @param array|null $nextMissions
     */
    public function __construct(int $key, int $agentId, ?int $failMissionId, ?array $nextMissions) {
        $this->key = $key;
        $this->agentId = $agentId;
        $this->failMissionId = $failMissionId;
        $this->nextMissions = $nextMissions;
    }

    /**
     * @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 (Mission::validateKey($this->key))  {
            return $this->key; /*int*/
        }
        throw new Exception('never get to this Mission::key');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateKey(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:Mission::key");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getKey(): int {
        if (Mission::validateKey($this->key))  {
            return $this->key;
        }
        throw new Exception('never get to getKey Mission::key');
    }

    /**
     * @return int
     */
    public static function sampleKey(): int {
        return 31; /*31:key*/
    }

    /**
     * @param int $value
     * @throws Exception
     * @return int
     */
    public static function fromAgentId(int $value): int {
        return $value; /*int*/
    }

    /**
     * @throws Exception
     * @return int
     */
    public function toAgentId(): int {
        if (Mission::validateAgentId($this->agentId))  {
            return $this->agentId; /*int*/
        }
        throw new Exception('never get to this Mission::agentId');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateAgentId(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:Mission::agentId");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getAgentId(): int {
        if (Mission::validateAgentId($this->agentId))  {
            return $this->agentId;
        }
        throw new Exception('never get to getAgentId Mission::agentId');
    }

    /**
     * @return int
     */
    public static function sampleAgentId(): int {
        return 32; /*32:agentId*/
    }

    /**
     * @param ?int $value
     * @throws Exception
     * @return ?int
     */
    public static function fromFailMissionId(?int $value): ?int {
        if (!is_null($value)) {
            return $value; /*int*/
        } else {
            return null;
        }
    }

    /**
     * @throws Exception
     * @return ?int
     */
    public function toFailMissionId(): ?int {
        if (Mission::validateFailMissionId($this->failMissionId))  {
            if (!is_null($this->failMissionId)) {
                return $this->failMissionId; /*int*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this Mission::failMissionId');
    }

    /**
     * @param int|null
     * @return bool
     * @throws Exception
     */
    public static function validateFailMissionId(?int $value): bool {
        if (!is_null($value)) {
            if (!is_integer($value)) {
                throw new Exception("Attribute Error:Mission::failMissionId");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?int
     */
    public function getFailMissionId(): ?int {
        if (Mission::validateFailMissionId($this->failMissionId))  {
            return $this->failMissionId;
        }
        throw new Exception('never get to getFailMissionId Mission::failMissionId');
    }

    /**
     * @return ?int
     */
    public static function sampleFailMissionId(): ?int {
        return 33; /*33:failMissionId*/
    }

    /**
     * @param ?array $value
     * @throws Exception
     * @return ?array
     */
    public static function fromNextMissions(?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 toNextMissions(): ?array {
        if (Mission::validateNextMissions($this->nextMissions))  {
            if (!is_null($this->nextMissions)) {
                return array_map(function ($value) {
                    return $value; /*int*/
                }, $this->nextMissions);
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this Mission::nextMissions');
    }

    /**
     * @param array|null
     * @return bool
     * @throws Exception
     */
    public static function validateNextMissions(?array $value): bool {
        if (!is_null($value)) {
            if (!is_array($value)) {
                throw new Exception("Attribute Error:Mission::nextMissions");
            }
            array_walk($value, function($value_v) {
                if (!is_integer($value_v)) {
                    throw new Exception("Attribute Error:Mission::nextMissions");
                }
            });
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?array
     */
    public function getNextMissions(): ?array {
        if (Mission::validateNextMissions($this->nextMissions))  {
            return $this->nextMissions;
        }
        throw new Exception('never get to getNextMissions Mission::nextMissions');
    }

    /**
     * @return ?array
     */
    public static function sampleNextMissions(): ?array {
        return  array(
            34 /*34:*/
        ); /* 34:nextMissions*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return Mission::validateKey($this->key)
        || Mission::validateAgentId($this->agentId)
        || Mission::validateFailMissionId($this->failMissionId)
        || Mission::validateNextMissions($this->nextMissions);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'agentID'} = $this->toAgentId();
        $out->{'failMissionID'} = $this->toFailMissionId();
        $out->{'nextMissions'} = $this->toNextMissions();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return Mission
     * @throws Exception
     */
    public static function from(stdClass $obj): Mission {
        return new Mission(
         Mission::fromKey($obj->{'_key'})
        ,Mission::fromAgentId($obj->{'agentID'})
        ,Mission::fromFailMissionId($obj->{'failMissionID'})
        ,Mission::fromNextMissions($obj->{'nextMissions'})
        );
    }

    /**
     * @return Mission
     */
    public static function sample(): Mission {
        return new Mission(
         Mission::sampleKey()
        ,Mission::sampleAgentId()
        ,Mission::sampleFailMissionId()
        ,Mission::sampleNextMissions()
        );
    }
}

// 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()
        );
    }
}
from typing import Optional, List, Any, TypeVar, Callable, Type, cast


T = TypeVar("T")


def from_int(x: Any) -> int:
    assert isinstance(x, int) and not isinstance(x, bool)
    return x


def from_none(x: Any) -> Any:
    assert x is None
    return x


def from_union(fs, x):
    for f in fs:
        try:
            return f(x)
        except:
            pass
    assert False


def from_list(f: Callable[[Any], T], x: Any) -> List[T]:
    assert isinstance(x, list)
    return [f(y) for y in x]


def from_str(x: Any) -> str:
    assert isinstance(x, str)
    return x


def to_class(c: Type[T], x: Any) -> dict:
    assert isinstance(x, c)
    return cast(Any, x).to_dict()


class Mission:
    key: int
    agent_id: int
    fail_mission_id: Optional[int]
    next_missions: Optional[List[int]]

    def __init__(self, key: int, agent_id: int, fail_mission_id: Optional[int], next_missions: Optional[List[int]]) -> None:
        self.key = key
        self.agent_id = agent_id
        self.fail_mission_id = fail_mission_id
        self.next_missions = next_missions

    @staticmethod
    def from_dict(obj: Any) -> 'Mission':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        agent_id = from_int(obj.get("agentID"))
        fail_mission_id = from_union([from_int, from_none], obj.get("failMissionID"))
        next_missions = from_union([lambda x: from_list(from_int, x), from_none], obj.get("nextMissions"))
        return Mission(key, agent_id, fail_mission_id, next_missions)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["agentID"] = from_int(self.agent_id)
        if self.fail_mission_id is not None:
            result["failMissionID"] = from_union([from_int, from_none], self.fail_mission_id)
        if self.next_missions is not None:
            result["nextMissions"] = from_union([lambda x: from_list(from_int, x), from_none], self.next_missions)
        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 EpicArc:
    key: int
    arc_restart_interval: int
    faction_id: Optional[int]
    icon_id: int
    missions: List[Mission]
    name: Name

    def __init__(self, key: int, arc_restart_interval: int, faction_id: Optional[int], icon_id: int, missions: List[Mission], name: Name) -> None:
        self.key = key
        self.arc_restart_interval = arc_restart_interval
        self.faction_id = faction_id
        self.icon_id = icon_id
        self.missions = missions
        self.name = name

    @staticmethod
    def from_dict(obj: Any) -> 'EpicArc':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        arc_restart_interval = from_int(obj.get("arcRestartInterval"))
        faction_id = from_union([from_int, from_none], obj.get("factionID"))
        icon_id = from_int(obj.get("iconID"))
        missions = from_list(Mission.from_dict, obj.get("missions"))
        name = Name.from_dict(obj.get("name"))
        return EpicArc(key, arc_restart_interval, faction_id, icon_id, missions, name)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["arcRestartInterval"] = from_int(self.arc_restart_interval)
        if self.faction_id is not None:
            result["factionID"] = from_union([from_int, from_none], self.faction_id)
        result["iconID"] = from_int(self.icon_id)
        result["missions"] = from_list(lambda x: to_class(Mission, x), self.missions)
        result["name"] = to_class(Name, self.name)
        return result


def epic_arc_from_dict(s: Any) -> EpicArc:
    return EpicArc.from_dict(s)


def epic_arc_to_dict(x: EpicArc) -> Any:
    return to_class(EpicArc, x)
// To parse this data:
//
//   import { Convert, EpicArc } from "./file";
//
//   const epicArc = Convert.toEpicArc(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.

export interface EpicArc {
    _key:               number;
    arcRestartInterval: number;
    factionID?:         number;
    iconID:             number;
    missions:           Mission[];
    name:               Name;
    [property: string]: any;
}

export interface Mission {
    _key:           number;
    agentID:        number;
    failMissionID?: number;
    nextMissions?:  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;
}

// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
    public static toEpicArc(json: string): EpicArc {
        return cast(JSON.parse(json), r("EpicArc"));
    }

    public static epicArcToJson(value: EpicArc): string {
        return JSON.stringify(uncast(value, r("EpicArc")), 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 = {
    "EpicArc": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "arcRestartInterval", js: "arcRestartInterval", typ: 0 },
        { json: "factionID", js: "factionID", typ: u(undefined, 0) },
        { json: "iconID", js: "iconID", typ: 0 },
        { json: "missions", js: "missions", typ: a(r("Mission")) },
        { json: "name", js: "name", typ: r("Name") },
    ], "any"),
    "Mission": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "agentID", js: "agentID", typ: 0 },
        { json: "failMissionID", js: "failMissionID", typ: u(undefined, 0) },
        { json: "nextMissions", js: "nextMissions", typ: u(undefined, a(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"),
};