Skip to content

EVE SDE Schema

Documentation for third-party developers

graphicMaterialSets.jsonl

Schema

  • _key (required): integer
    Range: 1 .. 3668
  • colorHull: object

    • a (required): number
      Range: 1 .. 1
    • b (required): number
      Range: 0 .. 1
    • g (required): number
      Range: 0 .. 1
    • r (required): number
      Range: 0 .. 1
  • colorPrimary: object

    • a (required): number
      Range: 1 .. 1
    • b (required): number
      Range: 0 .. 1
    • g (required): number
      Range: 0 .. 1
    • r (required): number
      Range: 0 .. 1
  • colorSecondary: object

    • a (required): number
      Range: 1 .. 1
    • b (required): number
      Range: 0 .. 1
    • g (required): number
      Range: 0 .. 1
    • r (required): number
      Range: 0 .. 1
  • colorWindow: object

    • a (required): number
      Range: 1 .. 1
    • b (required): number
      Range: 0 .. 1
    • g (required): number
      Range: 0 .. 1
    • r (required): number
      Range: 0 .. 1
  • custommaterial1: string

  • custommaterial2: string
  • description (required): string
  • material1: string
  • material2: string
  • material3: string
  • material4: string
  • resPathInsert: string
  • sofFactionName: string
  • sofPatternName: string
  • sofRaceHint: enum
    Enum values: amarr, gallente, caldari, minmatar, ore, jove, soe, angel, soct, mordu, sansha, generic, concord, triglavian, `,deathless`

Code snippets

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

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

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

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

        [JsonProperty("colorHull", NullValueHandling = NullValueHandling.Ignore)]
        public ColorHull ColorHull { get; set; }

        [JsonProperty("colorPrimary", NullValueHandling = NullValueHandling.Ignore)]
        public ColorPrimary ColorPrimary { get; set; }

        [JsonProperty("colorSecondary", NullValueHandling = NullValueHandling.Ignore)]
        public ColorSecondary ColorSecondary { get; set; }

        [JsonProperty("colorWindow", NullValueHandling = NullValueHandling.Ignore)]
        public ColorWindow ColorWindow { get; set; }

        [JsonProperty("custommaterial1", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string Custommaterial1 { get; set; }

        [JsonProperty("custommaterial2", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
        public string Custommaterial2 { get; set; }

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

        [JsonProperty("material1", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
        public string Material1 { get; set; }

        [JsonProperty("material2", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
        public string Material2 { get; set; }

        [JsonProperty("material3", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
        public string Material3 { get; set; }

        [JsonProperty("material4", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
        public string Material4 { get; set; }

        [JsonProperty("resPathInsert", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
        public string ResPathInsert { get; set; }

        [JsonProperty("sofFactionName", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(HilariousMinMaxLengthCheckConverter))]
        public string SofFactionName { get; set; }

        [JsonProperty("sofPatternName", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(AmbitiousMinMaxLengthCheckConverter))]
        public string SofPatternName { get; set; }

        [JsonProperty("sofRaceHint", NullValueHandling = NullValueHandling.Ignore)]
        public SofRaceHint? SofRaceHint { get; set; }
    }

    public partial class ColorHull
    {
        [JsonProperty("a")]
        [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
        public double A { get; set; }

        [JsonProperty("b")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double B { get; set; }

        [JsonProperty("g")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double G { get; set; }

        [JsonProperty("r")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double R { get; set; }
    }

    public partial class ColorPrimary
    {
        [JsonProperty("a")]
        [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
        public double A { get; set; }

        [JsonProperty("b")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double B { get; set; }

        [JsonProperty("g")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double G { get; set; }

        [JsonProperty("r")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double R { get; set; }
    }

    public partial class ColorSecondary
    {
        [JsonProperty("a")]
        [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
        public double A { get; set; }

        [JsonProperty("b")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double B { get; set; }

        [JsonProperty("g")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double G { get; set; }

        [JsonProperty("r")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double R { get; set; }
    }

    public partial class ColorWindow
    {
        [JsonProperty("a")]
        [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
        public double A { get; set; }

        [JsonProperty("b")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double B { get; set; }

        [JsonProperty("g")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double G { get; set; }

        [JsonProperty("r")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double R { get; set; }
    }

    public enum SofRaceHint { Amarr, Angel, Caldari, Concord, Deathless, Empty, Gallente, Generic, Jove, Minmatar, Mordu, Ore, Sansha, Soct, Soe, Triglavian };

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

    public static class Serialize
    {
        public static string ToJson(this GraphicMaterialSet 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 =
            {
                SofRaceHintConverter.Singleton,
                new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
            },
        };
    }

    internal class PurpleMinMaxValueCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null) return null;
            var value = serializer.Deserialize<double>(reader);
            if (value >= 1 && value <= 1)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type double");
        }

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

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

    internal class FluffyMinMaxValueCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null) return null;
            var value = serializer.Deserialize<double>(reader);
            if (value >= 0 && value <= 1)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type double");
        }

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

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

    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 >= 13 && value.Length <= 36)
            {
                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 >= 13 && value.Length <= 36)
            {
                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 >= 13 && value.Length <= 35)
            {
                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 >= 13 && value.Length <= 35)
            {
                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 >= 5 && value.Length <= 71)
            {
                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 <= 71)
            {
                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 >= 4 && value.Length <= 29)
            {
                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 <= 29)
            {
                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 >= 4 && 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 >= 4 && value.Length <= 30)
            {
                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 >= 0 && value.Length <= 13)
            {
                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 >= 0 && value.Length <= 13)
            {
                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 >= 3 && value.Length <= 35)
            {
                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 <= 35)
            {
                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 >= 3 && 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 >= 3 && value.Length <= 44)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

    internal class SofRaceHintConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(SofRaceHint) || t == typeof(SofRaceHint?);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null) return null;
            var value = serializer.Deserialize<string>(reader);
            switch (value)
            {
                case "":
                    return SofRaceHint.Empty;
                case "amarr":
                    return SofRaceHint.Amarr;
                case "angel":
                    return SofRaceHint.Angel;
                case "caldari":
                    return SofRaceHint.Caldari;
                case "concord":
                    return SofRaceHint.Concord;
                case "deathless":
                    return SofRaceHint.Deathless;
                case "gallente":
                    return SofRaceHint.Gallente;
                case "generic":
                    return SofRaceHint.Generic;
                case "jove":
                    return SofRaceHint.Jove;
                case "minmatar":
                    return SofRaceHint.Minmatar;
                case "mordu":
                    return SofRaceHint.Mordu;
                case "ore":
                    return SofRaceHint.Ore;
                case "sansha":
                    return SofRaceHint.Sansha;
                case "soct":
                    return SofRaceHint.Soct;
                case "soe":
                    return SofRaceHint.Soe;
                case "triglavian":
                    return SofRaceHint.Triglavian;
            }
            throw new Exception("Cannot unmarshal type SofRaceHint");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            if (untypedValue == null)
            {
                serializer.Serialize(writer, null);
                return;
            }
            var value = (SofRaceHint)untypedValue;
            switch (value)
            {
                case SofRaceHint.Empty:
                    serializer.Serialize(writer, "");
                    return;
                case SofRaceHint.Amarr:
                    serializer.Serialize(writer, "amarr");
                    return;
                case SofRaceHint.Angel:
                    serializer.Serialize(writer, "angel");
                    return;
                case SofRaceHint.Caldari:
                    serializer.Serialize(writer, "caldari");
                    return;
                case SofRaceHint.Concord:
                    serializer.Serialize(writer, "concord");
                    return;
                case SofRaceHint.Deathless:
                    serializer.Serialize(writer, "deathless");
                    return;
                case SofRaceHint.Gallente:
                    serializer.Serialize(writer, "gallente");
                    return;
                case SofRaceHint.Generic:
                    serializer.Serialize(writer, "generic");
                    return;
                case SofRaceHint.Jove:
                    serializer.Serialize(writer, "jove");
                    return;
                case SofRaceHint.Minmatar:
                    serializer.Serialize(writer, "minmatar");
                    return;
                case SofRaceHint.Mordu:
                    serializer.Serialize(writer, "mordu");
                    return;
                case SofRaceHint.Ore:
                    serializer.Serialize(writer, "ore");
                    return;
                case SofRaceHint.Sansha:
                    serializer.Serialize(writer, "sansha");
                    return;
                case SofRaceHint.Soct:
                    serializer.Serialize(writer, "soct");
                    return;
                case SofRaceHint.Soe:
                    serializer.Serialize(writer, "soe");
                    return;
                case SofRaceHint.Triglavian:
                    serializer.Serialize(writer, "triglavian");
                    return;
            }
            throw new Exception("Cannot marshal type SofRaceHint");
        }

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

package model

import "encoding/json"

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

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

type GraphicMaterialSet struct {
    Key             int64           `json:"_key"`
    ColorHull       *ColorHull      `json:"colorHull,omitempty"`
    ColorPrimary    *ColorPrimary   `json:"colorPrimary,omitempty"`
    ColorSecondary  *ColorSecondary `json:"colorSecondary,omitempty"`
    ColorWindow     *ColorWindow    `json:"colorWindow,omitempty"`
    Custommaterial1 *string         `json:"custommaterial1,omitempty"`
    Custommaterial2 *string         `json:"custommaterial2,omitempty"`
    Description     string          `json:"description"`
    Material1       *string         `json:"material1,omitempty"`
    Material2       *string         `json:"material2,omitempty"`
    Material3       *string         `json:"material3,omitempty"`
    Material4       *string         `json:"material4,omitempty"`
    ResPathInsert   *string         `json:"resPathInsert,omitempty"`
    SofFactionName  *string         `json:"sofFactionName,omitempty"`
    SofPatternName  *string         `json:"sofPatternName,omitempty"`
    SofRaceHint     *SofRaceHint    `json:"sofRaceHint,omitempty"`
}

type ColorHull struct {
    A float64 `json:"a"`
    B float64 `json:"b"`
    G float64 `json:"g"`
    R float64 `json:"r"`
}

type ColorPrimary struct {
    A float64 `json:"a"`
    B float64 `json:"b"`
    G float64 `json:"g"`
    R float64 `json:"r"`
}

type ColorSecondary struct {
    A float64 `json:"a"`
    B float64 `json:"b"`
    G float64 `json:"g"`
    R float64 `json:"r"`
}

type ColorWindow struct {
    A float64 `json:"a"`
    B float64 `json:"b"`
    G float64 `json:"g"`
    R float64 `json:"r"`
}

type SofRaceHint string

const (
    Amarr      SofRaceHint = "amarr"
    Angel      SofRaceHint = "angel"
    Caldari    SofRaceHint = "caldari"
    Concord    SofRaceHint = "concord"
    Deathless  SofRaceHint = "deathless"
    Empty      SofRaceHint = ""
    Gallente   SofRaceHint = "gallente"
    Generic    SofRaceHint = "generic"
    Jove       SofRaceHint = "jove"
    Minmatar   SofRaceHint = "minmatar"
    Mordu      SofRaceHint = "mordu"
    Ore        SofRaceHint = "ore"
    SOE        SofRaceHint = "soe"
    Sansha     SofRaceHint = "sansha"
    Soct       SofRaceHint = "soct"
    Triglavian SofRaceHint = "triglavian"
)
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"_key":{"type":"integer","minimum":1,"maximum":3668},"colorHull":{"type":"object","properties":{"a":{"type":"number","minimum":1.0,"maximum":1.0},"b":{"type":"number","minimum":0.0,"maximum":1.0},"g":{"type":"number","minimum":0.0,"maximum":1.0},"r":{"type":"number","minimum":0.0,"maximum":1.0}},"required":["a","b","g","r"]},"colorPrimary":{"type":"object","properties":{"a":{"type":"number","minimum":1.0,"maximum":1.0},"b":{"type":"number","minimum":0.0,"maximum":1.0},"g":{"type":"number","minimum":0.0,"maximum":1.0},"r":{"type":"number","minimum":0.0,"maximum":1.0}},"required":["a","b","g","r"]},"colorSecondary":{"type":"object","properties":{"a":{"type":"number","minimum":1.0,"maximum":1.0},"b":{"type":"number","minimum":0.0,"maximum":1.0},"g":{"type":"number","minimum":0.0,"maximum":1.0},"r":{"type":"number","minimum":0.0,"maximum":1.0}},"required":["a","b","g","r"]},"colorWindow":{"type":"object","properties":{"a":{"type":"number","minimum":1.0,"maximum":1.0},"b":{"type":"number","minimum":0.0,"maximum":1.0},"g":{"type":"number","minimum":0.0,"maximum":1.0},"r":{"type":"number","minimum":0.0,"maximum":1.0}},"required":["a","b","g","r"]},"custommaterial1":{"type":"string","minLength":13,"maxLength":36},"custommaterial2":{"type":"string","minLength":13,"maxLength":35},"description":{"type":"string","minLength":5,"maxLength":71},"material1":{"type":"string","minLength":4,"maxLength":29},"material2":{"type":"string","minLength":4,"maxLength":29},"material3":{"type":"string","minLength":4,"maxLength":30},"material4":{"type":"string","minLength":4,"maxLength":30},"resPathInsert":{"type":"string","minLength":0,"maxLength":13},"sofFactionName":{"type":"string","minLength":3,"maxLength":35},"sofPatternName":{"type":"string","minLength":3,"maxLength":44},"sofRaceHint":{"type":"string","enum":["amarr","gallente","caldari","minmatar","ore","jove","soe","angel","soct","mordu","sansha","generic","concord","triglavian","","deathless"]}},"required":["_key","description"]}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json               = Json { allowStructuredMapKeys = true }
// val graphicMaterialSet = json.parse(GraphicMaterialSet.serializer(), jsonString)

package model

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

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

    val colorHull: ColorHull? = null,
    val colorPrimary: ColorPrimary? = null,
    val colorSecondary: ColorSecondary? = null,
    val colorWindow: ColorWindow? = null,
    val custommaterial1: String? = null,
    val custommaterial2: String? = null,
    val description: String,
    val material1: String? = null,
    val material2: String? = null,
    val material3: String? = null,
    val material4: String? = null,
    val resPathInsert: String? = null,
    val sofFactionName: String? = null,
    val sofPatternName: String? = null,
    val sofRaceHint: SofRaceHint? = null
)

@Serializable
data class ColorHull (
    val a: Double,
    val b: Double,
    val g: Double,
    val r: Double
)

@Serializable
data class ColorPrimary (
    val a: Double,
    val b: Double,
    val g: Double,
    val r: Double
)

@Serializable
data class ColorSecondary (
    val a: Double,
    val b: Double,
    val g: Double,
    val r: Double
)

@Serializable
data class ColorWindow (
    val a: Double,
    val b: Double,
    val g: Double,
    val r: Double
)

@Serializable
enum class SofRaceHint(val value: String) {
    @SerialName("amarr") Amarr("amarr"),
    @SerialName("angel") Angel("angel"),
    @SerialName("caldari") Caldari("caldari"),
    @SerialName("concord") Concord("concord"),
    @SerialName("deathless") Deathless("deathless"),
    @SerialName("") Empty(""),
    @SerialName("gallente") Gallente("gallente"),
    @SerialName("generic") Generic("generic"),
    @SerialName("jove") Jove("jove"),
    @SerialName("minmatar") Minmatar("minmatar"),
    @SerialName("mordu") Mordu("mordu"),
    @SerialName("ore") Ore("ore"),
    @SerialName("soe") SOE("soe"),
    @SerialName("sansha") Sansha("sansha"),
    @SerialName("soct") Soct("soct"),
    @SerialName("triglavian") Triglavian("triglavian");
}
<?php

// This is a autogenerated file:GraphicMaterialSet

class GraphicMaterialSet {
    private int $key; // json:_key Required
    private ?ColorHull $colorHull; // json:colorHull Optional
    private ?ColorPrimary $colorPrimary; // json:colorPrimary Optional
    private ?ColorSecondary $colorSecondary; // json:colorSecondary Optional
    private ?ColorWindow $colorWindow; // json:colorWindow Optional
    private ?string $custommaterial1; // json:custommaterial1 Optional
    private ?string $custommaterial2; // json:custommaterial2 Optional
    private string $description; // json:description Required
    private ?string $material1; // json:material1 Optional
    private ?string $material2; // json:material2 Optional
    private ?string $material3; // json:material3 Optional
    private ?string $material4; // json:material4 Optional
    private ?string $resPathInsert; // json:resPathInsert Optional
    private ?string $sofFactionName; // json:sofFactionName Optional
    private ?string $sofPatternName; // json:sofPatternName Optional
    private ?SofRaceHint $sofRaceHint; // json:sofRaceHint Optional

    /**
     * @param int $key
     * @param ColorHull|null $colorHull
     * @param ColorPrimary|null $colorPrimary
     * @param ColorSecondary|null $colorSecondary
     * @param ColorWindow|null $colorWindow
     * @param string|null $custommaterial1
     * @param string|null $custommaterial2
     * @param string $description
     * @param string|null $material1
     * @param string|null $material2
     * @param string|null $material3
     * @param string|null $material4
     * @param string|null $resPathInsert
     * @param string|null $sofFactionName
     * @param string|null $sofPatternName
     * @param SofRaceHint|null $sofRaceHint
     */
    public function __construct(int $key, ?ColorHull $colorHull, ?ColorPrimary $colorPrimary, ?ColorSecondary $colorSecondary, ?ColorWindow $colorWindow, ?string $custommaterial1, ?string $custommaterial2, string $description, ?string $material1, ?string $material2, ?string $material3, ?string $material4, ?string $resPathInsert, ?string $sofFactionName, ?string $sofPatternName, ?SofRaceHint $sofRaceHint) {
        $this->key = $key;
        $this->colorHull = $colorHull;
        $this->colorPrimary = $colorPrimary;
        $this->colorSecondary = $colorSecondary;
        $this->colorWindow = $colorWindow;
        $this->custommaterial1 = $custommaterial1;
        $this->custommaterial2 = $custommaterial2;
        $this->description = $description;
        $this->material1 = $material1;
        $this->material2 = $material2;
        $this->material3 = $material3;
        $this->material4 = $material4;
        $this->resPathInsert = $resPathInsert;
        $this->sofFactionName = $sofFactionName;
        $this->sofPatternName = $sofPatternName;
        $this->sofRaceHint = $sofRaceHint;
    }

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

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

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

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

    /**
     * @param ?stdClass $value
     * @throws Exception
     * @return ?ColorHull
     */
    public static function fromColorHull(?stdClass $value): ?ColorHull {
        if (!is_null($value)) {
            return ColorHull::from($value); /*class*/
        } else {
            return null;
        }
    }

    /**
     * @throws Exception
     * @return ?stdClass
     */
    public function toColorHull(): ?stdClass {
        if (GraphicMaterialSet::validateColorHull($this->colorHull))  {
            if (!is_null($this->colorHull)) {
                return $this->colorHull->to(); /*class*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::colorHull');
    }

    /**
     * @param ColorHull|null
     * @return bool
     * @throws Exception
     */
    public static function validateColorHull(?ColorHull $value): bool {
        if (!is_null($value)) {
            $value->validate();
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?ColorHull
     */
    public function getColorHull(): ?ColorHull {
        if (GraphicMaterialSet::validateColorHull($this->colorHull))  {
            return $this->colorHull;
        }
        throw new Exception('never get to getColorHull GraphicMaterialSet::colorHull');
    }

    /**
     * @return ?ColorHull
     */
    public static function sampleColorHull(): ?ColorHull {
        return ColorHull::sample(); /*32:colorHull*/
    }

    /**
     * @param ?stdClass $value
     * @throws Exception
     * @return ?ColorPrimary
     */
    public static function fromColorPrimary(?stdClass $value): ?ColorPrimary {
        if (!is_null($value)) {
            return ColorPrimary::from($value); /*class*/
        } else {
            return null;
        }
    }

    /**
     * @throws Exception
     * @return ?stdClass
     */
    public function toColorPrimary(): ?stdClass {
        if (GraphicMaterialSet::validateColorPrimary($this->colorPrimary))  {
            if (!is_null($this->colorPrimary)) {
                return $this->colorPrimary->to(); /*class*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::colorPrimary');
    }

    /**
     * @param ColorPrimary|null
     * @return bool
     * @throws Exception
     */
    public static function validateColorPrimary(?ColorPrimary $value): bool {
        if (!is_null($value)) {
            $value->validate();
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?ColorPrimary
     */
    public function getColorPrimary(): ?ColorPrimary {
        if (GraphicMaterialSet::validateColorPrimary($this->colorPrimary))  {
            return $this->colorPrimary;
        }
        throw new Exception('never get to getColorPrimary GraphicMaterialSet::colorPrimary');
    }

    /**
     * @return ?ColorPrimary
     */
    public static function sampleColorPrimary(): ?ColorPrimary {
        return ColorPrimary::sample(); /*33:colorPrimary*/
    }

    /**
     * @param ?stdClass $value
     * @throws Exception
     * @return ?ColorSecondary
     */
    public static function fromColorSecondary(?stdClass $value): ?ColorSecondary {
        if (!is_null($value)) {
            return ColorSecondary::from($value); /*class*/
        } else {
            return null;
        }
    }

    /**
     * @throws Exception
     * @return ?stdClass
     */
    public function toColorSecondary(): ?stdClass {
        if (GraphicMaterialSet::validateColorSecondary($this->colorSecondary))  {
            if (!is_null($this->colorSecondary)) {
                return $this->colorSecondary->to(); /*class*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::colorSecondary');
    }

    /**
     * @param ColorSecondary|null
     * @return bool
     * @throws Exception
     */
    public static function validateColorSecondary(?ColorSecondary $value): bool {
        if (!is_null($value)) {
            $value->validate();
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?ColorSecondary
     */
    public function getColorSecondary(): ?ColorSecondary {
        if (GraphicMaterialSet::validateColorSecondary($this->colorSecondary))  {
            return $this->colorSecondary;
        }
        throw new Exception('never get to getColorSecondary GraphicMaterialSet::colorSecondary');
    }

    /**
     * @return ?ColorSecondary
     */
    public static function sampleColorSecondary(): ?ColorSecondary {
        return ColorSecondary::sample(); /*34:colorSecondary*/
    }

    /**
     * @param ?stdClass $value
     * @throws Exception
     * @return ?ColorWindow
     */
    public static function fromColorWindow(?stdClass $value): ?ColorWindow {
        if (!is_null($value)) {
            return ColorWindow::from($value); /*class*/
        } else {
            return null;
        }
    }

    /**
     * @throws Exception
     * @return ?stdClass
     */
    public function toColorWindow(): ?stdClass {
        if (GraphicMaterialSet::validateColorWindow($this->colorWindow))  {
            if (!is_null($this->colorWindow)) {
                return $this->colorWindow->to(); /*class*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::colorWindow');
    }

    /**
     * @param ColorWindow|null
     * @return bool
     * @throws Exception
     */
    public static function validateColorWindow(?ColorWindow $value): bool {
        if (!is_null($value)) {
            $value->validate();
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?ColorWindow
     */
    public function getColorWindow(): ?ColorWindow {
        if (GraphicMaterialSet::validateColorWindow($this->colorWindow))  {
            return $this->colorWindow;
        }
        throw new Exception('never get to getColorWindow GraphicMaterialSet::colorWindow');
    }

    /**
     * @return ?ColorWindow
     */
    public static function sampleColorWindow(): ?ColorWindow {
        return ColorWindow::sample(); /*35:colorWindow*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toCustommaterial1(): ?string {
        if (GraphicMaterialSet::validateCustommaterial1($this->custommaterial1))  {
            if (!is_null($this->custommaterial1)) {
                return $this->custommaterial1; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::custommaterial1');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateCustommaterial1(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::custommaterial1");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getCustommaterial1(): ?string {
        if (GraphicMaterialSet::validateCustommaterial1($this->custommaterial1))  {
            return $this->custommaterial1;
        }
        throw new Exception('never get to getCustommaterial1 GraphicMaterialSet::custommaterial1');
    }

    /**
     * @return ?string
     */
    public static function sampleCustommaterial1(): ?string {
        return 'GraphicMaterialSet::custommaterial1::36'; /*36:custommaterial1*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toCustommaterial2(): ?string {
        if (GraphicMaterialSet::validateCustommaterial2($this->custommaterial2))  {
            if (!is_null($this->custommaterial2)) {
                return $this->custommaterial2; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::custommaterial2');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateCustommaterial2(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::custommaterial2");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getCustommaterial2(): ?string {
        if (GraphicMaterialSet::validateCustommaterial2($this->custommaterial2))  {
            return $this->custommaterial2;
        }
        throw new Exception('never get to getCustommaterial2 GraphicMaterialSet::custommaterial2');
    }

    /**
     * @return ?string
     */
    public static function sampleCustommaterial2(): ?string {
        return 'GraphicMaterialSet::custommaterial2::37'; /*37:custommaterial2*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toDescription(): string {
        if (GraphicMaterialSet::validateDescription($this->description))  {
            return $this->description; /*string*/
        }
        throw new Exception('never get to this GraphicMaterialSet::description');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateDescription(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:GraphicMaterialSet::description");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getDescription(): string {
        if (GraphicMaterialSet::validateDescription($this->description))  {
            return $this->description;
        }
        throw new Exception('never get to getDescription GraphicMaterialSet::description');
    }

    /**
     * @return string
     */
    public static function sampleDescription(): string {
        return 'GraphicMaterialSet::description::38'; /*38:description*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toMaterial1(): ?string {
        if (GraphicMaterialSet::validateMaterial1($this->material1))  {
            if (!is_null($this->material1)) {
                return $this->material1; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::material1');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateMaterial1(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::material1");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getMaterial1(): ?string {
        if (GraphicMaterialSet::validateMaterial1($this->material1))  {
            return $this->material1;
        }
        throw new Exception('never get to getMaterial1 GraphicMaterialSet::material1');
    }

    /**
     * @return ?string
     */
    public static function sampleMaterial1(): ?string {
        return 'GraphicMaterialSet::material1::39'; /*39:material1*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toMaterial2(): ?string {
        if (GraphicMaterialSet::validateMaterial2($this->material2))  {
            if (!is_null($this->material2)) {
                return $this->material2; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::material2');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateMaterial2(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::material2");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getMaterial2(): ?string {
        if (GraphicMaterialSet::validateMaterial2($this->material2))  {
            return $this->material2;
        }
        throw new Exception('never get to getMaterial2 GraphicMaterialSet::material2');
    }

    /**
     * @return ?string
     */
    public static function sampleMaterial2(): ?string {
        return 'GraphicMaterialSet::material2::40'; /*40:material2*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toMaterial3(): ?string {
        if (GraphicMaterialSet::validateMaterial3($this->material3))  {
            if (!is_null($this->material3)) {
                return $this->material3; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::material3');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateMaterial3(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::material3");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getMaterial3(): ?string {
        if (GraphicMaterialSet::validateMaterial3($this->material3))  {
            return $this->material3;
        }
        throw new Exception('never get to getMaterial3 GraphicMaterialSet::material3');
    }

    /**
     * @return ?string
     */
    public static function sampleMaterial3(): ?string {
        return 'GraphicMaterialSet::material3::41'; /*41:material3*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toMaterial4(): ?string {
        if (GraphicMaterialSet::validateMaterial4($this->material4))  {
            if (!is_null($this->material4)) {
                return $this->material4; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::material4');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateMaterial4(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::material4");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getMaterial4(): ?string {
        if (GraphicMaterialSet::validateMaterial4($this->material4))  {
            return $this->material4;
        }
        throw new Exception('never get to getMaterial4 GraphicMaterialSet::material4');
    }

    /**
     * @return ?string
     */
    public static function sampleMaterial4(): ?string {
        return 'GraphicMaterialSet::material4::42'; /*42:material4*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toResPathInsert(): ?string {
        if (GraphicMaterialSet::validateResPathInsert($this->resPathInsert))  {
            if (!is_null($this->resPathInsert)) {
                return $this->resPathInsert; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::resPathInsert');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateResPathInsert(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::resPathInsert");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getResPathInsert(): ?string {
        if (GraphicMaterialSet::validateResPathInsert($this->resPathInsert))  {
            return $this->resPathInsert;
        }
        throw new Exception('never get to getResPathInsert GraphicMaterialSet::resPathInsert');
    }

    /**
     * @return ?string
     */
    public static function sampleResPathInsert(): ?string {
        return 'GraphicMaterialSet::resPathInsert::43'; /*43:resPathInsert*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toSofFactionName(): ?string {
        if (GraphicMaterialSet::validateSofFactionName($this->sofFactionName))  {
            if (!is_null($this->sofFactionName)) {
                return $this->sofFactionName; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::sofFactionName');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateSofFactionName(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::sofFactionName");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getSofFactionName(): ?string {
        if (GraphicMaterialSet::validateSofFactionName($this->sofFactionName))  {
            return $this->sofFactionName;
        }
        throw new Exception('never get to getSofFactionName GraphicMaterialSet::sofFactionName');
    }

    /**
     * @return ?string
     */
    public static function sampleSofFactionName(): ?string {
        return 'GraphicMaterialSet::sofFactionName::44'; /*44:sofFactionName*/
    }

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toSofPatternName(): ?string {
        if (GraphicMaterialSet::validateSofPatternName($this->sofPatternName))  {
            if (!is_null($this->sofPatternName)) {
                return $this->sofPatternName; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::sofPatternName');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateSofPatternName(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:GraphicMaterialSet::sofPatternName");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getSofPatternName(): ?string {
        if (GraphicMaterialSet::validateSofPatternName($this->sofPatternName))  {
            return $this->sofPatternName;
        }
        throw new Exception('never get to getSofPatternName GraphicMaterialSet::sofPatternName');
    }

    /**
     * @return ?string
     */
    public static function sampleSofPatternName(): ?string {
        return 'GraphicMaterialSet::sofPatternName::45'; /*45:sofPatternName*/
    }

    /**
     * @param ?string $value
     * @throws Exception
     * @return ?SofRaceHint
     */
    public static function fromSofRaceHint(?string $value): ?SofRaceHint {
        if (!is_null($value)) {
            return SofRaceHint::from($value); /*enum*/
        } else {
            return null;
        }
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function toSofRaceHint(): ?string {
        if (GraphicMaterialSet::validateSofRaceHint($this->sofRaceHint))  {
            if (!is_null($this->sofRaceHint)) {
                return SofRaceHint::to($this->sofRaceHint); /*enum*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this GraphicMaterialSet::sofRaceHint');
    }

    /**
     * @param SofRaceHint|null
     * @return bool
     * @throws Exception
     */
    public static function validateSofRaceHint(?SofRaceHint $value): bool {
        if (!is_null($value)) {
            SofRaceHint::to($value);
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?SofRaceHint
     */
    public function getSofRaceHint(): ?SofRaceHint {
        if (GraphicMaterialSet::validateSofRaceHint($this->sofRaceHint))  {
            return $this->sofRaceHint;
        }
        throw new Exception('never get to getSofRaceHint GraphicMaterialSet::sofRaceHint');
    }

    /**
     * @return ?SofRaceHint
     */
    public static function sampleSofRaceHint(): ?SofRaceHint {
        return SofRaceHint::sample(); /*enum*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return GraphicMaterialSet::validateKey($this->key)
        || GraphicMaterialSet::validateColorHull($this->colorHull)
        || GraphicMaterialSet::validateColorPrimary($this->colorPrimary)
        || GraphicMaterialSet::validateColorSecondary($this->colorSecondary)
        || GraphicMaterialSet::validateColorWindow($this->colorWindow)
        || GraphicMaterialSet::validateCustommaterial1($this->custommaterial1)
        || GraphicMaterialSet::validateCustommaterial2($this->custommaterial2)
        || GraphicMaterialSet::validateDescription($this->description)
        || GraphicMaterialSet::validateMaterial1($this->material1)
        || GraphicMaterialSet::validateMaterial2($this->material2)
        || GraphicMaterialSet::validateMaterial3($this->material3)
        || GraphicMaterialSet::validateMaterial4($this->material4)
        || GraphicMaterialSet::validateResPathInsert($this->resPathInsert)
        || GraphicMaterialSet::validateSofFactionName($this->sofFactionName)
        || GraphicMaterialSet::validateSofPatternName($this->sofPatternName)
        || GraphicMaterialSet::validateSofRaceHint($this->sofRaceHint);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'colorHull'} = $this->toColorHull();
        $out->{'colorPrimary'} = $this->toColorPrimary();
        $out->{'colorSecondary'} = $this->toColorSecondary();
        $out->{'colorWindow'} = $this->toColorWindow();
        $out->{'custommaterial1'} = $this->toCustommaterial1();
        $out->{'custommaterial2'} = $this->toCustommaterial2();
        $out->{'description'} = $this->toDescription();
        $out->{'material1'} = $this->toMaterial1();
        $out->{'material2'} = $this->toMaterial2();
        $out->{'material3'} = $this->toMaterial3();
        $out->{'material4'} = $this->toMaterial4();
        $out->{'resPathInsert'} = $this->toResPathInsert();
        $out->{'sofFactionName'} = $this->toSofFactionName();
        $out->{'sofPatternName'} = $this->toSofPatternName();
        $out->{'sofRaceHint'} = $this->toSofRaceHint();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return GraphicMaterialSet
     * @throws Exception
     */
    public static function from(stdClass $obj): GraphicMaterialSet {
        return new GraphicMaterialSet(
         GraphicMaterialSet::fromKey($obj->{'_key'})
        ,GraphicMaterialSet::fromColorHull($obj->{'colorHull'})
        ,GraphicMaterialSet::fromColorPrimary($obj->{'colorPrimary'})
        ,GraphicMaterialSet::fromColorSecondary($obj->{'colorSecondary'})
        ,GraphicMaterialSet::fromColorWindow($obj->{'colorWindow'})
        ,GraphicMaterialSet::fromCustommaterial1($obj->{'custommaterial1'})
        ,GraphicMaterialSet::fromCustommaterial2($obj->{'custommaterial2'})
        ,GraphicMaterialSet::fromDescription($obj->{'description'})
        ,GraphicMaterialSet::fromMaterial1($obj->{'material1'})
        ,GraphicMaterialSet::fromMaterial2($obj->{'material2'})
        ,GraphicMaterialSet::fromMaterial3($obj->{'material3'})
        ,GraphicMaterialSet::fromMaterial4($obj->{'material4'})
        ,GraphicMaterialSet::fromResPathInsert($obj->{'resPathInsert'})
        ,GraphicMaterialSet::fromSofFactionName($obj->{'sofFactionName'})
        ,GraphicMaterialSet::fromSofPatternName($obj->{'sofPatternName'})
        ,GraphicMaterialSet::fromSofRaceHint($obj->{'sofRaceHint'})
        );
    }

    /**
     * @return GraphicMaterialSet
     */
    public static function sample(): GraphicMaterialSet {
        return new GraphicMaterialSet(
         GraphicMaterialSet::sampleKey()
        ,GraphicMaterialSet::sampleColorHull()
        ,GraphicMaterialSet::sampleColorPrimary()
        ,GraphicMaterialSet::sampleColorSecondary()
        ,GraphicMaterialSet::sampleColorWindow()
        ,GraphicMaterialSet::sampleCustommaterial1()
        ,GraphicMaterialSet::sampleCustommaterial2()
        ,GraphicMaterialSet::sampleDescription()
        ,GraphicMaterialSet::sampleMaterial1()
        ,GraphicMaterialSet::sampleMaterial2()
        ,GraphicMaterialSet::sampleMaterial3()
        ,GraphicMaterialSet::sampleMaterial4()
        ,GraphicMaterialSet::sampleResPathInsert()
        ,GraphicMaterialSet::sampleSofFactionName()
        ,GraphicMaterialSet::sampleSofPatternName()
        ,GraphicMaterialSet::sampleSofRaceHint()
        );
    }
}

// This is a autogenerated file:ColorHull

class ColorHull {
    private float $a; // json:a Required
    private float $b; // json:b Required
    private float $g; // json:g Required
    private float $r; // json:r Required

    /**
     * @param float $a
     * @param float $b
     * @param float $g
     * @param float $r
     */
    public function __construct(float $a, float $b, float $g, float $r) {
        $this->a = $a;
        $this->b = $b;
        $this->g = $g;
        $this->r = $r;
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toA(): float {
        if (ColorHull::validateA($this->a))  {
            return $this->a; /*float*/
        }
        throw new Exception('never get to this ColorHull::a');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateA(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorHull::a");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getA(): float {
        if (ColorHull::validateA($this->a))  {
            return $this->a;
        }
        throw new Exception('never get to getA ColorHull::a');
    }

    /**
     * @return float
     */
    public static function sampleA(): float {
        return 31.031; /*31:a*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toB(): float {
        if (ColorHull::validateB($this->b))  {
            return $this->b; /*float*/
        }
        throw new Exception('never get to this ColorHull::b');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateB(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorHull::b");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getB(): float {
        if (ColorHull::validateB($this->b))  {
            return $this->b;
        }
        throw new Exception('never get to getB ColorHull::b');
    }

    /**
     * @return float
     */
    public static function sampleB(): float {
        return 32.032; /*32:b*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toG(): float {
        if (ColorHull::validateG($this->g))  {
            return $this->g; /*float*/
        }
        throw new Exception('never get to this ColorHull::g');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateG(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorHull::g");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getG(): float {
        if (ColorHull::validateG($this->g))  {
            return $this->g;
        }
        throw new Exception('never get to getG ColorHull::g');
    }

    /**
     * @return float
     */
    public static function sampleG(): float {
        return 33.033; /*33:g*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toR(): float {
        if (ColorHull::validateR($this->r))  {
            return $this->r; /*float*/
        }
        throw new Exception('never get to this ColorHull::r');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateR(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorHull::r");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getR(): float {
        if (ColorHull::validateR($this->r))  {
            return $this->r;
        }
        throw new Exception('never get to getR ColorHull::r');
    }

    /**
     * @return float
     */
    public static function sampleR(): float {
        return 34.034; /*34:r*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return ColorHull::validateA($this->a)
        || ColorHull::validateB($this->b)
        || ColorHull::validateG($this->g)
        || ColorHull::validateR($this->r);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'a'} = $this->toA();
        $out->{'b'} = $this->toB();
        $out->{'g'} = $this->toG();
        $out->{'r'} = $this->toR();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return ColorHull
     * @throws Exception
     */
    public static function from(stdClass $obj): ColorHull {
        return new ColorHull(
         ColorHull::fromA($obj->{'a'})
        ,ColorHull::fromB($obj->{'b'})
        ,ColorHull::fromG($obj->{'g'})
        ,ColorHull::fromR($obj->{'r'})
        );
    }

    /**
     * @return ColorHull
     */
    public static function sample(): ColorHull {
        return new ColorHull(
         ColorHull::sampleA()
        ,ColorHull::sampleB()
        ,ColorHull::sampleG()
        ,ColorHull::sampleR()
        );
    }
}

// This is a autogenerated file:ColorPrimary

class ColorPrimary {
    private float $a; // json:a Required
    private float $b; // json:b Required
    private float $g; // json:g Required
    private float $r; // json:r Required

    /**
     * @param float $a
     * @param float $b
     * @param float $g
     * @param float $r
     */
    public function __construct(float $a, float $b, float $g, float $r) {
        $this->a = $a;
        $this->b = $b;
        $this->g = $g;
        $this->r = $r;
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toA(): float {
        if (ColorPrimary::validateA($this->a))  {
            return $this->a; /*float*/
        }
        throw new Exception('never get to this ColorPrimary::a');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateA(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorPrimary::a");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getA(): float {
        if (ColorPrimary::validateA($this->a))  {
            return $this->a;
        }
        throw new Exception('never get to getA ColorPrimary::a');
    }

    /**
     * @return float
     */
    public static function sampleA(): float {
        return 31.031; /*31:a*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toB(): float {
        if (ColorPrimary::validateB($this->b))  {
            return $this->b; /*float*/
        }
        throw new Exception('never get to this ColorPrimary::b');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateB(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorPrimary::b");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getB(): float {
        if (ColorPrimary::validateB($this->b))  {
            return $this->b;
        }
        throw new Exception('never get to getB ColorPrimary::b');
    }

    /**
     * @return float
     */
    public static function sampleB(): float {
        return 32.032; /*32:b*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toG(): float {
        if (ColorPrimary::validateG($this->g))  {
            return $this->g; /*float*/
        }
        throw new Exception('never get to this ColorPrimary::g');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateG(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorPrimary::g");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getG(): float {
        if (ColorPrimary::validateG($this->g))  {
            return $this->g;
        }
        throw new Exception('never get to getG ColorPrimary::g');
    }

    /**
     * @return float
     */
    public static function sampleG(): float {
        return 33.033; /*33:g*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toR(): float {
        if (ColorPrimary::validateR($this->r))  {
            return $this->r; /*float*/
        }
        throw new Exception('never get to this ColorPrimary::r');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateR(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorPrimary::r");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getR(): float {
        if (ColorPrimary::validateR($this->r))  {
            return $this->r;
        }
        throw new Exception('never get to getR ColorPrimary::r');
    }

    /**
     * @return float
     */
    public static function sampleR(): float {
        return 34.034; /*34:r*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return ColorPrimary::validateA($this->a)
        || ColorPrimary::validateB($this->b)
        || ColorPrimary::validateG($this->g)
        || ColorPrimary::validateR($this->r);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'a'} = $this->toA();
        $out->{'b'} = $this->toB();
        $out->{'g'} = $this->toG();
        $out->{'r'} = $this->toR();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return ColorPrimary
     * @throws Exception
     */
    public static function from(stdClass $obj): ColorPrimary {
        return new ColorPrimary(
         ColorPrimary::fromA($obj->{'a'})
        ,ColorPrimary::fromB($obj->{'b'})
        ,ColorPrimary::fromG($obj->{'g'})
        ,ColorPrimary::fromR($obj->{'r'})
        );
    }

    /**
     * @return ColorPrimary
     */
    public static function sample(): ColorPrimary {
        return new ColorPrimary(
         ColorPrimary::sampleA()
        ,ColorPrimary::sampleB()
        ,ColorPrimary::sampleG()
        ,ColorPrimary::sampleR()
        );
    }
}

// This is a autogenerated file:ColorSecondary

class ColorSecondary {
    private float $a; // json:a Required
    private float $b; // json:b Required
    private float $g; // json:g Required
    private float $r; // json:r Required

    /**
     * @param float $a
     * @param float $b
     * @param float $g
     * @param float $r
     */
    public function __construct(float $a, float $b, float $g, float $r) {
        $this->a = $a;
        $this->b = $b;
        $this->g = $g;
        $this->r = $r;
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toA(): float {
        if (ColorSecondary::validateA($this->a))  {
            return $this->a; /*float*/
        }
        throw new Exception('never get to this ColorSecondary::a');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateA(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorSecondary::a");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getA(): float {
        if (ColorSecondary::validateA($this->a))  {
            return $this->a;
        }
        throw new Exception('never get to getA ColorSecondary::a');
    }

    /**
     * @return float
     */
    public static function sampleA(): float {
        return 31.031; /*31:a*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toB(): float {
        if (ColorSecondary::validateB($this->b))  {
            return $this->b; /*float*/
        }
        throw new Exception('never get to this ColorSecondary::b');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateB(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorSecondary::b");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getB(): float {
        if (ColorSecondary::validateB($this->b))  {
            return $this->b;
        }
        throw new Exception('never get to getB ColorSecondary::b');
    }

    /**
     * @return float
     */
    public static function sampleB(): float {
        return 32.032; /*32:b*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toG(): float {
        if (ColorSecondary::validateG($this->g))  {
            return $this->g; /*float*/
        }
        throw new Exception('never get to this ColorSecondary::g');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateG(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorSecondary::g");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getG(): float {
        if (ColorSecondary::validateG($this->g))  {
            return $this->g;
        }
        throw new Exception('never get to getG ColorSecondary::g');
    }

    /**
     * @return float
     */
    public static function sampleG(): float {
        return 33.033; /*33:g*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toR(): float {
        if (ColorSecondary::validateR($this->r))  {
            return $this->r; /*float*/
        }
        throw new Exception('never get to this ColorSecondary::r');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateR(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorSecondary::r");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getR(): float {
        if (ColorSecondary::validateR($this->r))  {
            return $this->r;
        }
        throw new Exception('never get to getR ColorSecondary::r');
    }

    /**
     * @return float
     */
    public static function sampleR(): float {
        return 34.034; /*34:r*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return ColorSecondary::validateA($this->a)
        || ColorSecondary::validateB($this->b)
        || ColorSecondary::validateG($this->g)
        || ColorSecondary::validateR($this->r);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'a'} = $this->toA();
        $out->{'b'} = $this->toB();
        $out->{'g'} = $this->toG();
        $out->{'r'} = $this->toR();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return ColorSecondary
     * @throws Exception
     */
    public static function from(stdClass $obj): ColorSecondary {
        return new ColorSecondary(
         ColorSecondary::fromA($obj->{'a'})
        ,ColorSecondary::fromB($obj->{'b'})
        ,ColorSecondary::fromG($obj->{'g'})
        ,ColorSecondary::fromR($obj->{'r'})
        );
    }

    /**
     * @return ColorSecondary
     */
    public static function sample(): ColorSecondary {
        return new ColorSecondary(
         ColorSecondary::sampleA()
        ,ColorSecondary::sampleB()
        ,ColorSecondary::sampleG()
        ,ColorSecondary::sampleR()
        );
    }
}

// This is a autogenerated file:ColorWindow

class ColorWindow {
    private float $a; // json:a Required
    private float $b; // json:b Required
    private float $g; // json:g Required
    private float $r; // json:r Required

    /**
     * @param float $a
     * @param float $b
     * @param float $g
     * @param float $r
     */
    public function __construct(float $a, float $b, float $g, float $r) {
        $this->a = $a;
        $this->b = $b;
        $this->g = $g;
        $this->r = $r;
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toA(): float {
        if (ColorWindow::validateA($this->a))  {
            return $this->a; /*float*/
        }
        throw new Exception('never get to this ColorWindow::a');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateA(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorWindow::a");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getA(): float {
        if (ColorWindow::validateA($this->a))  {
            return $this->a;
        }
        throw new Exception('never get to getA ColorWindow::a');
    }

    /**
     * @return float
     */
    public static function sampleA(): float {
        return 31.031; /*31:a*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toB(): float {
        if (ColorWindow::validateB($this->b))  {
            return $this->b; /*float*/
        }
        throw new Exception('never get to this ColorWindow::b');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateB(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorWindow::b");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getB(): float {
        if (ColorWindow::validateB($this->b))  {
            return $this->b;
        }
        throw new Exception('never get to getB ColorWindow::b');
    }

    /**
     * @return float
     */
    public static function sampleB(): float {
        return 32.032; /*32:b*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toG(): float {
        if (ColorWindow::validateG($this->g))  {
            return $this->g; /*float*/
        }
        throw new Exception('never get to this ColorWindow::g');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateG(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorWindow::g");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getG(): float {
        if (ColorWindow::validateG($this->g))  {
            return $this->g;
        }
        throw new Exception('never get to getG ColorWindow::g');
    }

    /**
     * @return float
     */
    public static function sampleG(): float {
        return 33.033; /*33:g*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toR(): float {
        if (ColorWindow::validateR($this->r))  {
            return $this->r; /*float*/
        }
        throw new Exception('never get to this ColorWindow::r');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateR(float $value): bool {
        if (!is_float($value)) {
            throw new Exception("Attribute Error:ColorWindow::r");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getR(): float {
        if (ColorWindow::validateR($this->r))  {
            return $this->r;
        }
        throw new Exception('never get to getR ColorWindow::r');
    }

    /**
     * @return float
     */
    public static function sampleR(): float {
        return 34.034; /*34:r*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return ColorWindow::validateA($this->a)
        || ColorWindow::validateB($this->b)
        || ColorWindow::validateG($this->g)
        || ColorWindow::validateR($this->r);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'a'} = $this->toA();
        $out->{'b'} = $this->toB();
        $out->{'g'} = $this->toG();
        $out->{'r'} = $this->toR();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return ColorWindow
     * @throws Exception
     */
    public static function from(stdClass $obj): ColorWindow {
        return new ColorWindow(
         ColorWindow::fromA($obj->{'a'})
        ,ColorWindow::fromB($obj->{'b'})
        ,ColorWindow::fromG($obj->{'g'})
        ,ColorWindow::fromR($obj->{'r'})
        );
    }

    /**
     * @return ColorWindow
     */
    public static function sample(): ColorWindow {
        return new ColorWindow(
         ColorWindow::sampleA()
        ,ColorWindow::sampleB()
        ,ColorWindow::sampleG()
        ,ColorWindow::sampleR()
        );
    }
}

// This is a autogenerated file:SofRaceHint

class SofRaceHint {
    public static SofRaceHint $AMARR;
    public static SofRaceHint $ANGEL;
    public static SofRaceHint $CALDARI;
    public static SofRaceHint $CONCORD;
    public static SofRaceHint $DEATHLESS;
    public static SofRaceHint $EMPTY;
    public static SofRaceHint $GALLENTE;
    public static SofRaceHint $GENERIC;
    public static SofRaceHint $JOVE;
    public static SofRaceHint $MINMATAR;
    public static SofRaceHint $MORDU;
    public static SofRaceHint $ORE;
    public static SofRaceHint $SANSHA;
    public static SofRaceHint $SOCT;
    public static SofRaceHint $SOE;
    public static SofRaceHint $TRIGLAVIAN;
    public static function init() {
        SofRaceHint::$AMARR = new SofRaceHint('amarr');
        SofRaceHint::$ANGEL = new SofRaceHint('angel');
        SofRaceHint::$CALDARI = new SofRaceHint('caldari');
        SofRaceHint::$CONCORD = new SofRaceHint('concord');
        SofRaceHint::$DEATHLESS = new SofRaceHint('deathless');
        SofRaceHint::$EMPTY = new SofRaceHint('');
        SofRaceHint::$GALLENTE = new SofRaceHint('gallente');
        SofRaceHint::$GENERIC = new SofRaceHint('generic');
        SofRaceHint::$JOVE = new SofRaceHint('jove');
        SofRaceHint::$MINMATAR = new SofRaceHint('minmatar');
        SofRaceHint::$MORDU = new SofRaceHint('mordu');
        SofRaceHint::$ORE = new SofRaceHint('ore');
        SofRaceHint::$SANSHA = new SofRaceHint('sansha');
        SofRaceHint::$SOCT = new SofRaceHint('soct');
        SofRaceHint::$SOE = new SofRaceHint('soe');
        SofRaceHint::$TRIGLAVIAN = new SofRaceHint('triglavian');
    }
    private string $enum;
    public function __construct(string $enum) {
        $this->enum = $enum;
    }

    /**
     * @param SofRaceHint
     * @return string
     * @throws Exception
     */
    public static function to(SofRaceHint $obj): string {
        switch ($obj->enum) {
            case SofRaceHint::$AMARR->enum: return 'amarr';
            case SofRaceHint::$ANGEL->enum: return 'angel';
            case SofRaceHint::$CALDARI->enum: return 'caldari';
            case SofRaceHint::$CONCORD->enum: return 'concord';
            case SofRaceHint::$DEATHLESS->enum: return 'deathless';
            case SofRaceHint::$EMPTY->enum: return '';
            case SofRaceHint::$GALLENTE->enum: return 'gallente';
            case SofRaceHint::$GENERIC->enum: return 'generic';
            case SofRaceHint::$JOVE->enum: return 'jove';
            case SofRaceHint::$MINMATAR->enum: return 'minmatar';
            case SofRaceHint::$MORDU->enum: return 'mordu';
            case SofRaceHint::$ORE->enum: return 'ore';
            case SofRaceHint::$SANSHA->enum: return 'sansha';
            case SofRaceHint::$SOCT->enum: return 'soct';
            case SofRaceHint::$SOE->enum: return 'soe';
            case SofRaceHint::$TRIGLAVIAN->enum: return 'triglavian';
        }
        throw new Exception('the give value is not an enum-value.');
    }

    /**
     * @param mixed
     * @return SofRaceHint
     * @throws Exception
     */
    public static function from($obj): SofRaceHint {
        switch ($obj) {
            case 'amarr': return SofRaceHint::$AMARR;
            case 'angel': return SofRaceHint::$ANGEL;
            case 'caldari': return SofRaceHint::$CALDARI;
            case 'concord': return SofRaceHint::$CONCORD;
            case 'deathless': return SofRaceHint::$DEATHLESS;
            case '': return SofRaceHint::$EMPTY;
            case 'gallente': return SofRaceHint::$GALLENTE;
            case 'generic': return SofRaceHint::$GENERIC;
            case 'jove': return SofRaceHint::$JOVE;
            case 'minmatar': return SofRaceHint::$MINMATAR;
            case 'mordu': return SofRaceHint::$MORDU;
            case 'ore': return SofRaceHint::$ORE;
            case 'sansha': return SofRaceHint::$SANSHA;
            case 'soct': return SofRaceHint::$SOCT;
            case 'soe': return SofRaceHint::$SOE;
            case 'triglavian': return SofRaceHint::$TRIGLAVIAN;
        }
        throw new Exception("Cannot deserialize SofRaceHint");
    }

    /**
     * @return SofRaceHint
     */
    public static function sample(): SofRaceHint {
        return SofRaceHint::$AMARR;
    }
}
SofRaceHint::init();
from typing import Any, Optional, TypeVar, Type, cast
from enum import Enum


T = TypeVar("T")
EnumT = TypeVar("EnumT", bound=Enum)


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


def to_float(x: Any) -> float:
    assert isinstance(x, (int, float))
    return x


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


def from_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_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()


def to_enum(c: Type[EnumT], x: Any) -> EnumT:
    assert isinstance(x, c)
    return x.value


class ColorHull:
    a: float
    b: float
    g: float
    r: float

    def __init__(self, a: float, b: float, g: float, r: float) -> None:
        self.a = a
        self.b = b
        self.g = g
        self.r = r

    @staticmethod
    def from_dict(obj: Any) -> 'ColorHull':
        assert isinstance(obj, dict)
        a = from_float(obj.get("a"))
        b = from_float(obj.get("b"))
        g = from_float(obj.get("g"))
        r = from_float(obj.get("r"))
        return ColorHull(a, b, g, r)

    def to_dict(self) -> dict:
        result: dict = {}
        result["a"] = to_float(self.a)
        result["b"] = to_float(self.b)
        result["g"] = to_float(self.g)
        result["r"] = to_float(self.r)
        return result


class ColorPrimary:
    a: float
    b: float
    g: float
    r: float

    def __init__(self, a: float, b: float, g: float, r: float) -> None:
        self.a = a
        self.b = b
        self.g = g
        self.r = r

    @staticmethod
    def from_dict(obj: Any) -> 'ColorPrimary':
        assert isinstance(obj, dict)
        a = from_float(obj.get("a"))
        b = from_float(obj.get("b"))
        g = from_float(obj.get("g"))
        r = from_float(obj.get("r"))
        return ColorPrimary(a, b, g, r)

    def to_dict(self) -> dict:
        result: dict = {}
        result["a"] = to_float(self.a)
        result["b"] = to_float(self.b)
        result["g"] = to_float(self.g)
        result["r"] = to_float(self.r)
        return result


class ColorSecondary:
    a: float
    b: float
    g: float
    r: float

    def __init__(self, a: float, b: float, g: float, r: float) -> None:
        self.a = a
        self.b = b
        self.g = g
        self.r = r

    @staticmethod
    def from_dict(obj: Any) -> 'ColorSecondary':
        assert isinstance(obj, dict)
        a = from_float(obj.get("a"))
        b = from_float(obj.get("b"))
        g = from_float(obj.get("g"))
        r = from_float(obj.get("r"))
        return ColorSecondary(a, b, g, r)

    def to_dict(self) -> dict:
        result: dict = {}
        result["a"] = to_float(self.a)
        result["b"] = to_float(self.b)
        result["g"] = to_float(self.g)
        result["r"] = to_float(self.r)
        return result


class ColorWindow:
    a: float
    b: float
    g: float
    r: float

    def __init__(self, a: float, b: float, g: float, r: float) -> None:
        self.a = a
        self.b = b
        self.g = g
        self.r = r

    @staticmethod
    def from_dict(obj: Any) -> 'ColorWindow':
        assert isinstance(obj, dict)
        a = from_float(obj.get("a"))
        b = from_float(obj.get("b"))
        g = from_float(obj.get("g"))
        r = from_float(obj.get("r"))
        return ColorWindow(a, b, g, r)

    def to_dict(self) -> dict:
        result: dict = {}
        result["a"] = to_float(self.a)
        result["b"] = to_float(self.b)
        result["g"] = to_float(self.g)
        result["r"] = to_float(self.r)
        return result


class SofRaceHint(Enum):
    AMARR = "amarr"
    ANGEL = "angel"
    CALDARI = "caldari"
    CONCORD = "concord"
    DEATHLESS = "deathless"
    EMPTY = ""
    GALLENTE = "gallente"
    GENERIC = "generic"
    JOVE = "jove"
    MINMATAR = "minmatar"
    MORDU = "mordu"
    ORE = "ore"
    SANSHA = "sansha"
    SOCT = "soct"
    SOE = "soe"
    TRIGLAVIAN = "triglavian"


class GraphicMaterialSet:
    key: int
    color_hull: Optional[ColorHull]
    color_primary: Optional[ColorPrimary]
    color_secondary: Optional[ColorSecondary]
    color_window: Optional[ColorWindow]
    custommaterial1: Optional[str]
    custommaterial2: Optional[str]
    description: str
    material1: Optional[str]
    material2: Optional[str]
    material3: Optional[str]
    material4: Optional[str]
    res_path_insert: Optional[str]
    sof_faction_name: Optional[str]
    sof_pattern_name: Optional[str]
    sof_race_hint: Optional[SofRaceHint]

    def __init__(self, key: int, color_hull: Optional[ColorHull], color_primary: Optional[ColorPrimary], color_secondary: Optional[ColorSecondary], color_window: Optional[ColorWindow], custommaterial1: Optional[str], custommaterial2: Optional[str], description: str, material1: Optional[str], material2: Optional[str], material3: Optional[str], material4: Optional[str], res_path_insert: Optional[str], sof_faction_name: Optional[str], sof_pattern_name: Optional[str], sof_race_hint: Optional[SofRaceHint]) -> None:
        self.key = key
        self.color_hull = color_hull
        self.color_primary = color_primary
        self.color_secondary = color_secondary
        self.color_window = color_window
        self.custommaterial1 = custommaterial1
        self.custommaterial2 = custommaterial2
        self.description = description
        self.material1 = material1
        self.material2 = material2
        self.material3 = material3
        self.material4 = material4
        self.res_path_insert = res_path_insert
        self.sof_faction_name = sof_faction_name
        self.sof_pattern_name = sof_pattern_name
        self.sof_race_hint = sof_race_hint

    @staticmethod
    def from_dict(obj: Any) -> 'GraphicMaterialSet':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        color_hull = from_union([ColorHull.from_dict, from_none], obj.get("colorHull"))
        color_primary = from_union([ColorPrimary.from_dict, from_none], obj.get("colorPrimary"))
        color_secondary = from_union([ColorSecondary.from_dict, from_none], obj.get("colorSecondary"))
        color_window = from_union([ColorWindow.from_dict, from_none], obj.get("colorWindow"))
        custommaterial1 = from_union([from_str, from_none], obj.get("custommaterial1"))
        custommaterial2 = from_union([from_str, from_none], obj.get("custommaterial2"))
        description = from_str(obj.get("description"))
        material1 = from_union([from_str, from_none], obj.get("material1"))
        material2 = from_union([from_str, from_none], obj.get("material2"))
        material3 = from_union([from_str, from_none], obj.get("material3"))
        material4 = from_union([from_str, from_none], obj.get("material4"))
        res_path_insert = from_union([from_str, from_none], obj.get("resPathInsert"))
        sof_faction_name = from_union([from_str, from_none], obj.get("sofFactionName"))
        sof_pattern_name = from_union([from_str, from_none], obj.get("sofPatternName"))
        sof_race_hint = from_union([SofRaceHint, from_none], obj.get("sofRaceHint"))
        return GraphicMaterialSet(key, color_hull, color_primary, color_secondary, color_window, custommaterial1, custommaterial2, description, material1, material2, material3, material4, res_path_insert, sof_faction_name, sof_pattern_name, sof_race_hint)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        if self.color_hull is not None:
            result["colorHull"] = from_union([lambda x: to_class(ColorHull, x), from_none], self.color_hull)
        if self.color_primary is not None:
            result["colorPrimary"] = from_union([lambda x: to_class(ColorPrimary, x), from_none], self.color_primary)
        if self.color_secondary is not None:
            result["colorSecondary"] = from_union([lambda x: to_class(ColorSecondary, x), from_none], self.color_secondary)
        if self.color_window is not None:
            result["colorWindow"] = from_union([lambda x: to_class(ColorWindow, x), from_none], self.color_window)
        if self.custommaterial1 is not None:
            result["custommaterial1"] = from_union([from_str, from_none], self.custommaterial1)
        if self.custommaterial2 is not None:
            result["custommaterial2"] = from_union([from_str, from_none], self.custommaterial2)
        result["description"] = from_str(self.description)
        if self.material1 is not None:
            result["material1"] = from_union([from_str, from_none], self.material1)
        if self.material2 is not None:
            result["material2"] = from_union([from_str, from_none], self.material2)
        if self.material3 is not None:
            result["material3"] = from_union([from_str, from_none], self.material3)
        if self.material4 is not None:
            result["material4"] = from_union([from_str, from_none], self.material4)
        if self.res_path_insert is not None:
            result["resPathInsert"] = from_union([from_str, from_none], self.res_path_insert)
        if self.sof_faction_name is not None:
            result["sofFactionName"] = from_union([from_str, from_none], self.sof_faction_name)
        if self.sof_pattern_name is not None:
            result["sofPatternName"] = from_union([from_str, from_none], self.sof_pattern_name)
        if self.sof_race_hint is not None:
            result["sofRaceHint"] = from_union([lambda x: to_enum(SofRaceHint, x), from_none], self.sof_race_hint)
        return result


def graphic_material_set_from_dict(s: Any) -> GraphicMaterialSet:
    return GraphicMaterialSet.from_dict(s)


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

export interface GraphicMaterialSet {
    _key:             number;
    colorHull?:       ColorHull;
    colorPrimary?:    ColorPrimary;
    colorSecondary?:  ColorSecondary;
    colorWindow?:     ColorWindow;
    custommaterial1?: string;
    custommaterial2?: string;
    description:      string;
    material1?:       string;
    material2?:       string;
    material3?:       string;
    material4?:       string;
    resPathInsert?:   string;
    sofFactionName?:  string;
    sofPatternName?:  string;
    sofRaceHint?:     SofRaceHint;
    [property: string]: any;
}

export interface ColorHull {
    a: number;
    b: number;
    g: number;
    r: number;
    [property: string]: any;
}

export interface ColorPrimary {
    a: number;
    b: number;
    g: number;
    r: number;
    [property: string]: any;
}

export interface ColorSecondary {
    a: number;
    b: number;
    g: number;
    r: number;
    [property: string]: any;
}

export interface ColorWindow {
    a: number;
    b: number;
    g: number;
    r: number;
    [property: string]: any;
}

export enum SofRaceHint {
    Amarr = "amarr",
    Angel = "angel",
    Caldari = "caldari",
    Concord = "concord",
    Deathless = "deathless",
    Empty = "",
    Gallente = "gallente",
    Generic = "generic",
    Jove = "jove",
    Minmatar = "minmatar",
    Mordu = "mordu",
    Ore = "ore",
    Sansha = "sansha",
    Soct = "soct",
    Soe = "soe",
    Triglavian = "triglavian",
}

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

    public static graphicMaterialSetToJson(value: GraphicMaterialSet): string {
        return JSON.stringify(uncast(value, r("GraphicMaterialSet")), 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 = {
    "GraphicMaterialSet": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "colorHull", js: "colorHull", typ: u(undefined, r("ColorHull")) },
        { json: "colorPrimary", js: "colorPrimary", typ: u(undefined, r("ColorPrimary")) },
        { json: "colorSecondary", js: "colorSecondary", typ: u(undefined, r("ColorSecondary")) },
        { json: "colorWindow", js: "colorWindow", typ: u(undefined, r("ColorWindow")) },
        { json: "custommaterial1", js: "custommaterial1", typ: u(undefined, "") },
        { json: "custommaterial2", js: "custommaterial2", typ: u(undefined, "") },
        { json: "description", js: "description", typ: "" },
        { json: "material1", js: "material1", typ: u(undefined, "") },
        { json: "material2", js: "material2", typ: u(undefined, "") },
        { json: "material3", js: "material3", typ: u(undefined, "") },
        { json: "material4", js: "material4", typ: u(undefined, "") },
        { json: "resPathInsert", js: "resPathInsert", typ: u(undefined, "") },
        { json: "sofFactionName", js: "sofFactionName", typ: u(undefined, "") },
        { json: "sofPatternName", js: "sofPatternName", typ: u(undefined, "") },
        { json: "sofRaceHint", js: "sofRaceHint", typ: u(undefined, r("SofRaceHint")) },
    ], "any"),
    "ColorHull": o([
        { json: "a", js: "a", typ: 3.14 },
        { json: "b", js: "b", typ: 3.14 },
        { json: "g", js: "g", typ: 3.14 },
        { json: "r", js: "r", typ: 3.14 },
    ], "any"),
    "ColorPrimary": o([
        { json: "a", js: "a", typ: 3.14 },
        { json: "b", js: "b", typ: 3.14 },
        { json: "g", js: "g", typ: 3.14 },
        { json: "r", js: "r", typ: 3.14 },
    ], "any"),
    "ColorSecondary": o([
        { json: "a", js: "a", typ: 3.14 },
        { json: "b", js: "b", typ: 3.14 },
        { json: "g", js: "g", typ: 3.14 },
        { json: "r", js: "r", typ: 3.14 },
    ], "any"),
    "ColorWindow": o([
        { json: "a", js: "a", typ: 3.14 },
        { json: "b", js: "b", typ: 3.14 },
        { json: "g", js: "g", typ: 3.14 },
        { json: "r", js: "r", typ: 3.14 },
    ], "any"),
    "SofRaceHint": [
        "amarr",
        "angel",
        "caldari",
        "concord",
        "deathless",
        "",
        "gallente",
        "generic",
        "jove",
        "minmatar",
        "mordu",
        "ore",
        "sansha",
        "soct",
        "soe",
        "triglavian",
    ],
};