Skip to content

EVE SDE Schema

Documentation for third-party developers

planetSchematics.jsonl

Schema

  • _key (required): integer
    Range: 65 .. 135
  • cycleTime (required): integer
    Range: 1800 .. 3600
  • 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
  • pins (required): array of integer
    Type: integer
    Range: 2469 .. 2494

  • types (required): array of object
    • _key (required): integer
      Range: 44 .. 28974
    • isInput (required): boolean
    • quantity (required): integer
      Range: 1 .. 3000

Code snippets

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

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

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

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

        [JsonProperty("cycleTime")]
        public long CycleTime { get; set; }

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

        [JsonProperty("pins")]
        public long[] Pins { get; set; }

        [JsonProperty("types")]
        public TypeElement[] Types { get; set; }
    }

    public partial class Name
    {
        [JsonProperty("de")]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string De { get; set; }

        [JsonProperty("en")]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string En { get; set; }

        [JsonProperty("es")]
        [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
        public string Es { get; set; }

        [JsonProperty("fr")]
        [JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
        public string Fr { get; set; }

        [JsonProperty("ja")]
        [JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
        public string Ja { get; set; }

        [JsonProperty("ko")]
        [JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
        public string Ko { get; set; }

        [JsonProperty("ru")]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string Ru { get; set; }

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

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

        [JsonProperty("isInput")]
        public bool IsInput { get; set; }

        [JsonProperty("quantity")]
        public long Quantity { get; set; }
    }

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

    public static class Serialize
    {
        public static string ToJson(this PlanetSchematic 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 >= 5 && value.Length <= 30)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            var value = (string)untypedValue;
            if (value.Length >= 5 && value.Length <= 30)
            {
                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 >= 4 && 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 >= 4 && value.Length <= 44)
            {
                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 >= 3 && value.Length <= 38)
            {
                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 <= 38)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

        public static readonly TentacledMinMaxLengthCheckConverter Singleton = new TentacledMinMaxLengthCheckConverter();
    }

    internal class StickyMinMaxLengthCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            var value = serializer.Deserialize<string>(reader);
            if (value.Length >= 1 && value.Length <= 17)
            {
                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 <= 17)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

        public static readonly StickyMinMaxLengthCheckConverter Singleton = new StickyMinMaxLengthCheckConverter();
    }

    internal class IndigoMinMaxLengthCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            var value = serializer.Deserialize<string>(reader);
            if (value.Length >= 1 && value.Length <= 16)
            {
                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 <= 16)
            {
                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 >= 1 && value.Length <= 10)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

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

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

package model

import "encoding/json"

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

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

type PlanetSchematic struct {
    Key       int64   `json:"_key"`
    CycleTime int64   `json:"cycleTime"`
    Name      Name    `json:"name"`
    Pins      []int64 `json:"pins"`
    Types     []Type  `json:"types"`
}

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 Type struct {
    Key      int64 `json:"_key"`
    IsInput  bool  `json:"isInput"`
    Quantity int64 `json:"quantity"`
}
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
        "_key": {
            "type": "integer",
            "minimum": 65,
            "maximum": 135
        },
        "cycleTime": {
            "type": "integer",
            "minimum": 1800,
            "maximum": 3600
        },
        "name": {
            "type": "object",
            "properties": {
                "de": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 30
                },
                "en": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 30
                },
                "es": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 44
                },
                "fr": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 38
                },
                "ja": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 17
                },
                "ko": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16
                },
                "ru": {
                    "type": "string",
                    "minLength": 5,
                    "maxLength": 30
                },
                "zh": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10
                }
            },
            "required": [
                "de",
                "en",
                "es",
                "fr",
                "ja",
                "ko",
                "ru",
                "zh"
            ]
        },
        "pins": {
            "type": "array",
            "items": {
                "type": "integer",
                "minimum": 2469,
                "maximum": 2494
            },
            "minItems": 2,
            "maxItems": 8
        },
        "types": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "_key": {
                        "type": "integer",
                        "minimum": 44,
                        "maximum": 28974
                    },
                    "isInput": {
                        "type": "boolean"
                    },
                    "quantity": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 3000
                    }
                },
                "required": [
                    "_key",
                    "isInput",
                    "quantity"
                ]
            },
            "minItems": 2,
            "maxItems": 4
        }
    },
    "required": [
        "_key",
        "cycleTime",
        "name",
        "pins",
        "types"
    ]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json            = Json { allowStructuredMapKeys = true }
// val planetSchematic = json.parse(PlanetSchematic.serializer(), jsonString)

package model

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

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

    val cycleTime: Long,
    val name: Name,
    val pins: List<Long>,
    val types: List<Type>
)

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

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

    val isInput: Boolean,
    val quantity: Long
)
<?php

// This is a autogenerated file:PlanetSchematic

class PlanetSchematic {
    private int $key; // json:_key Required
    private int $cycleTime; // json:cycleTime Required
    private Name $name; // json:name Required
    private array $pins; // json:pins Required
    private array $types; // json:types Required

    /**
     * @param int $key
     * @param int $cycleTime
     * @param Name $name
     * @param array $pins
     * @param array $types
     */
    public function __construct(int $key, int $cycleTime, Name $name, array $pins, array $types) {
        $this->key = $key;
        $this->cycleTime = $cycleTime;
        $this->name = $name;
        $this->pins = $pins;
        $this->types = $types;
    }

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

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

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

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

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

    /**
     * @throws Exception
     * @return int
     */
    public function toCycleTime(): int {
        if (PlanetSchematic::validateCycleTime($this->cycleTime))  {
            return $this->cycleTime; /*int*/
        }
        throw new Exception('never get to this PlanetSchematic::cycleTime');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getCycleTime(): int {
        if (PlanetSchematic::validateCycleTime($this->cycleTime))  {
            return $this->cycleTime;
        }
        throw new Exception('never get to getCycleTime PlanetSchematic::cycleTime');
    }

    /**
     * @return int
     */
    public static function sampleCycleTime(): int {
        return 32; /*32:cycleTime*/
    }

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

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

    /**
     * @param array $value
     * @throws Exception
     * @return array
     */
    public static function fromPins(array $value): array {
        return  array_map(function ($value) {
            return $value; /*int*/
        }, $value);
    }

    /**
     * @throws Exception
     * @return array
     */
    public function toPins(): array {
        if (PlanetSchematic::validatePins($this->pins))  {
            return array_map(function ($value) {
                return $value; /*int*/
            }, $this->pins);
        }
        throw new Exception('never get to this PlanetSchematic::pins');
    }

    /**
     * @param array
     * @return bool
     * @throws Exception
     */
    public static function validatePins(array $value): bool {
        if (!is_array($value)) {
            throw new Exception("Attribute Error:PlanetSchematic::pins");
        }
        array_walk($value, function($value_v) {
            if (!is_integer($value_v)) {
                throw new Exception("Attribute Error:PlanetSchematic::pins");
            }
        });
        return true;
    }

    /**
     * @throws Exception
     * @return array
     */
    public function getPins(): array {
        if (PlanetSchematic::validatePins($this->pins))  {
            return $this->pins;
        }
        throw new Exception('never get to getPins PlanetSchematic::pins');
    }

    /**
     * @return array
     */
    public static function samplePins(): array {
        return  array(
            34 /*34:*/
        ); /* 34:pins*/
    }

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

    /**
     * @throws Exception
     * @return array
     */
    public function toTypes(): array {
        if (PlanetSchematic::validateTypes($this->types))  {
            return array_map(function ($value) {
                return $value->to(); /*class*/
            }, $this->types);
        }
        throw new Exception('never get to this PlanetSchematic::types');
    }

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

    /**
     * @throws Exception
     * @return array
     */
    public function getTypes(): array {
        if (PlanetSchematic::validateTypes($this->types))  {
            return $this->types;
        }
        throw new Exception('never get to getTypes PlanetSchematic::types');
    }

    /**
     * @return array
     */
    public static function sampleTypes(): array {
        return  array(
            Type::sample() /*35:*/
        ); /* 35:types*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return PlanetSchematic::validateKey($this->key)
        || PlanetSchematic::validateCycleTime($this->cycleTime)
        || PlanetSchematic::validateName($this->name)
        || PlanetSchematic::validatePins($this->pins)
        || PlanetSchematic::validateTypes($this->types);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'cycleTime'} = $this->toCycleTime();
        $out->{'name'} = $this->toName();
        $out->{'pins'} = $this->toPins();
        $out->{'types'} = $this->toTypes();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return PlanetSchematic
     * @throws Exception
     */
    public static function from(stdClass $obj): PlanetSchematic {
        return new PlanetSchematic(
         PlanetSchematic::fromKey($obj->{'_key'})
        ,PlanetSchematic::fromCycleTime($obj->{'cycleTime'})
        ,PlanetSchematic::fromName($obj->{'name'})
        ,PlanetSchematic::fromPins($obj->{'pins'})
        ,PlanetSchematic::fromTypes($obj->{'types'})
        );
    }

    /**
     * @return PlanetSchematic
     */
    public static function sample(): PlanetSchematic {
        return new PlanetSchematic(
         PlanetSchematic::sampleKey()
        ,PlanetSchematic::sampleCycleTime()
        ,PlanetSchematic::sampleName()
        ,PlanetSchematic::samplePins()
        ,PlanetSchematic::sampleTypes()
        );
    }
}

// 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:Type

class Type {
    private int $key; // json:_key Required
    private bool $isInput; // json:isInput Required
    private int $quantity; // json:quantity Required

    /**
     * @param int $key
     * @param bool $isInput
     * @param int $quantity
     */
    public function __construct(int $key, bool $isInput, int $quantity) {
        $this->key = $key;
        $this->isInput = $isInput;
        $this->quantity = $quantity;
    }

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

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

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

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

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

    /**
     * @throws Exception
     * @return bool
     */
    public function toIsInput(): bool {
        if (Type::validateIsInput($this->isInput))  {
            return $this->isInput; /*bool*/
        }
        throw new Exception('never get to this Type::isInput');
    }

    /**
     * @param bool
     * @return bool
     * @throws Exception
     */
    public static function validateIsInput(bool $value): bool {
        if (!is_bool($value)) {
            throw new Exception("Attribute Error:Type::isInput");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function getIsInput(): bool {
        if (Type::validateIsInput($this->isInput))  {
            return $this->isInput;
        }
        throw new Exception('never get to getIsInput Type::isInput');
    }

    /**
     * @return bool
     */
    public static function sampleIsInput(): bool {
        return true; /*32:isInput*/
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function toQuantity(): int {
        if (Type::validateQuantity($this->quantity))  {
            return $this->quantity; /*int*/
        }
        throw new Exception('never get to this Type::quantity');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getQuantity(): int {
        if (Type::validateQuantity($this->quantity))  {
            return $this->quantity;
        }
        throw new Exception('never get to getQuantity Type::quantity');
    }

    /**
     * @return int
     */
    public static function sampleQuantity(): int {
        return 33; /*33:quantity*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return Type::validateKey($this->key)
        || Type::validateIsInput($this->isInput)
        || Type::validateQuantity($this->quantity);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'isInput'} = $this->toIsInput();
        $out->{'quantity'} = $this->toQuantity();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return Type
     * @throws Exception
     */
    public static function from(stdClass $obj): Type {
        return new Type(
         Type::fromKey($obj->{'_key'})
        ,Type::fromIsInput($obj->{'isInput'})
        ,Type::fromQuantity($obj->{'quantity'})
        );
    }

    /**
     * @return Type
     */
    public static function sample(): Type {
        return new Type(
         Type::sampleKey()
        ,Type::sampleIsInput()
        ,Type::sampleQuantity()
        );
    }
}
from typing import Any, List, TypeVar, Callable, Type, cast


T = TypeVar("T")


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


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


def from_bool(x: Any) -> bool:
    assert isinstance(x, bool)
    return x


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


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


class Name:
    de: str
    en: str
    es: str
    fr: str
    ja: str
    ko: str
    ru: str
    zh: str

    def __init__(self, de: str, en: str, es: str, fr: str, ja: str, ko: str, ru: str, zh: str) -> None:
        self.de = de
        self.en = en
        self.es = es
        self.fr = fr
        self.ja = ja
        self.ko = ko
        self.ru = ru
        self.zh = zh

    @staticmethod
    def from_dict(obj: Any) -> 'Name':
        assert isinstance(obj, dict)
        de = from_str(obj.get("de"))
        en = from_str(obj.get("en"))
        es = from_str(obj.get("es"))
        fr = from_str(obj.get("fr"))
        ja = from_str(obj.get("ja"))
        ko = from_str(obj.get("ko"))
        ru = from_str(obj.get("ru"))
        zh = from_str(obj.get("zh"))
        return Name(de, en, es, fr, ja, ko, ru, zh)

    def to_dict(self) -> dict:
        result: dict = {}
        result["de"] = from_str(self.de)
        result["en"] = from_str(self.en)
        result["es"] = from_str(self.es)
        result["fr"] = from_str(self.fr)
        result["ja"] = from_str(self.ja)
        result["ko"] = from_str(self.ko)
        result["ru"] = from_str(self.ru)
        result["zh"] = from_str(self.zh)
        return result


class TypeElement:
    key: int
    is_input: bool
    quantity: int

    def __init__(self, key: int, is_input: bool, quantity: int) -> None:
        self.key = key
        self.is_input = is_input
        self.quantity = quantity

    @staticmethod
    def from_dict(obj: Any) -> 'TypeElement':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        is_input = from_bool(obj.get("isInput"))
        quantity = from_int(obj.get("quantity"))
        return TypeElement(key, is_input, quantity)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["isInput"] = from_bool(self.is_input)
        result["quantity"] = from_int(self.quantity)
        return result


class PlanetSchematic:
    key: int
    cycle_time: int
    name: Name
    pins: List[int]
    types: List[TypeElement]

    def __init__(self, key: int, cycle_time: int, name: Name, pins: List[int], types: List[TypeElement]) -> None:
        self.key = key
        self.cycle_time = cycle_time
        self.name = name
        self.pins = pins
        self.types = types

    @staticmethod
    def from_dict(obj: Any) -> 'PlanetSchematic':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        cycle_time = from_int(obj.get("cycleTime"))
        name = Name.from_dict(obj.get("name"))
        pins = from_list(from_int, obj.get("pins"))
        types = from_list(TypeElement.from_dict, obj.get("types"))
        return PlanetSchematic(key, cycle_time, name, pins, types)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["cycleTime"] = from_int(self.cycle_time)
        result["name"] = to_class(Name, self.name)
        result["pins"] = from_list(from_int, self.pins)
        result["types"] = from_list(lambda x: to_class(TypeElement, x), self.types)
        return result


def planet_schematic_from_dict(s: Any) -> PlanetSchematic:
    return PlanetSchematic.from_dict(s)


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

export interface PlanetSchematic {
    _key:      number;
    cycleTime: number;
    name:      Name;
    pins:      number[];
    types:     Type[];
    [property: string]: any;
}

export interface Name {
    de: string;
    en: string;
    es: string;
    fr: string;
    ja: string;
    ko: string;
    ru: string;
    zh: string;
    [property: string]: any;
}

export interface Type {
    _key:     number;
    isInput:  boolean;
    quantity: number;
    [property: string]: any;
}

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

    public static planetSchematicToJson(value: PlanetSchematic): string {
        return JSON.stringify(uncast(value, r("PlanetSchematic")), 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 = {
    "PlanetSchematic": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "cycleTime", js: "cycleTime", typ: 0 },
        { json: "name", js: "name", typ: r("Name") },
        { json: "pins", js: "pins", typ: a(0) },
        { json: "types", js: "types", typ: a(r("Type")) },
    ], "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"),
    "Type": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "isInput", js: "isInput", typ: true },
        { json: "quantity", js: "quantity", typ: 0 },
    ], "any"),
};