Skip to content

EVE SDE Schema

Documentation for third-party developers

corporationRoleGroups.jsonl

Schema

  • _key (required): integer
    Range: 1 .. 9
  • appliesTo (required): enum
    Enum values: roles, rolesAtHQ, rolesAtBase, rolesAtOther
  • appliesToGrantable (required): enum
    Enum values: grantableRoles, grantableRolesAtHQ, grantableRolesAtBase, grantableRolesAtOther
  • isDivisional (required): boolean
  • isLocational (required): boolean
  • name (required): object
    • de (required): string
    • en (required): string
    • es (required): string
    • fr (required): string
    • ja (required): string
    • ko (required): string
    • ru (required): string
    • zh (required): string

Code snippets

// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
//    using QuickType;
//
//    var corporationRoleGroup = CorporationRoleGroup.FromJson(jsonString);
#nullable enable
#pragma warning disable CS8618
#pragma warning disable CS8601
#pragma warning disable CS8602
#pragma warning disable CS8603

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

    using System.Text.Json;
    using System.Text.Json.Serialization;
    using System.Globalization;

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

        [JsonPropertyName("appliesTo")]
        public AppliesTo AppliesTo { get; set; }

        [JsonPropertyName("appliesToGrantable")]
        public AppliesToGrantable AppliesToGrantable { get; set; }

        [JsonPropertyName("isDivisional")]
        public bool IsDivisional { get; set; }

        [JsonPropertyName("isLocational")]
        public bool IsLocational { get; set; }

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

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

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

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

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

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

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

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

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

    public enum AppliesTo { Roles, RolesAtBase, RolesAtHq, RolesAtOther };

    public enum AppliesToGrantable { GrantableRoles, GrantableRolesAtBase, GrantableRolesAtHq, GrantableRolesAtOther };

    public partial class CorporationRoleGroup
    {
        public static CorporationRoleGroup FromJson(string json) => JsonSerializer.Deserialize<CorporationRoleGroup>(json, QuickType.Converter.Settings);
    }

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

    internal static class Converter
    {
        public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General)
        {
            Converters =
            {
                AppliesToConverter.Singleton,
                AppliesToGrantableConverter.Singleton,
                new DateOnlyConverter(),
                new TimeOnlyConverter(),
                IsoDateTimeOffsetConverter.Singleton
            },
        };
    }

    internal class AppliesToConverter : JsonConverter<AppliesTo>
    {
        public override bool CanConvert(Type t) => t == typeof(AppliesTo);

        public override AppliesTo Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            switch (value)
            {
                case "roles":
                    return AppliesTo.Roles;
                case "rolesAtBase":
                    return AppliesTo.RolesAtBase;
                case "rolesAtHQ":
                    return AppliesTo.RolesAtHq;
                case "rolesAtOther":
                    return AppliesTo.RolesAtOther;
            }
            throw new Exception("Cannot unmarshal type AppliesTo");
        }

        public override void Write(Utf8JsonWriter writer, AppliesTo value, JsonSerializerOptions options)
        {
            switch (value)
            {
                case AppliesTo.Roles:
                    JsonSerializer.Serialize(writer, "roles", options);
                    return;
                case AppliesTo.RolesAtBase:
                    JsonSerializer.Serialize(writer, "rolesAtBase", options);
                    return;
                case AppliesTo.RolesAtHq:
                    JsonSerializer.Serialize(writer, "rolesAtHQ", options);
                    return;
                case AppliesTo.RolesAtOther:
                    JsonSerializer.Serialize(writer, "rolesAtOther", options);
                    return;
            }
            throw new Exception("Cannot marshal type AppliesTo");
        }

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

    internal class AppliesToGrantableConverter : JsonConverter<AppliesToGrantable>
    {
        public override bool CanConvert(Type t) => t == typeof(AppliesToGrantable);

        public override AppliesToGrantable Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            switch (value)
            {
                case "grantableRoles":
                    return AppliesToGrantable.GrantableRoles;
                case "grantableRolesAtBase":
                    return AppliesToGrantable.GrantableRolesAtBase;
                case "grantableRolesAtHQ":
                    return AppliesToGrantable.GrantableRolesAtHq;
                case "grantableRolesAtOther":
                    return AppliesToGrantable.GrantableRolesAtOther;
            }
            throw new Exception("Cannot unmarshal type AppliesToGrantable");
        }

        public override void Write(Utf8JsonWriter writer, AppliesToGrantable value, JsonSerializerOptions options)
        {
            switch (value)
            {
                case AppliesToGrantable.GrantableRoles:
                    JsonSerializer.Serialize(writer, "grantableRoles", options);
                    return;
                case AppliesToGrantable.GrantableRolesAtBase:
                    JsonSerializer.Serialize(writer, "grantableRolesAtBase", options);
                    return;
                case AppliesToGrantable.GrantableRolesAtHq:
                    JsonSerializer.Serialize(writer, "grantableRolesAtHQ", options);
                    return;
                case AppliesToGrantable.GrantableRolesAtOther:
                    JsonSerializer.Serialize(writer, "grantableRolesAtOther", options);
                    return;
            }
            throw new Exception("Cannot marshal type AppliesToGrantable");
        }

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

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

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value.Length >= 9 && value.Length <= 33)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value.Length >= 9 && value.Length <= 33)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

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

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value.Length >= 7 && value.Length <= 31)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value.Length >= 7 && value.Length <= 31)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

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

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value.Length >= 7 && value.Length <= 39)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value.Length >= 7 && value.Length <= 39)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

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

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value.Length >= 11 && value.Length <= 37)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value.Length >= 11 && value.Length <= 37)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

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

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value.Length >= 2 && value.Length <= 12)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value.Length >= 2 && value.Length <= 12)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

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

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value.Length >= 2 && value.Length <= 15)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value.Length >= 2 && value.Length <= 15)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

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

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value.Length >= 5 && value.Length <= 45)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value.Length >= 5 && value.Length <= 45)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

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

        public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetString();
            if (value.Length >= 2 && value.Length <= 9)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
        {
            if (value.Length >= 2 && value.Length <= 9)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

    public class DateOnlyConverter : JsonConverter<DateOnly>
    {
        private readonly string serializationFormat;
        public DateOnlyConverter() : this(null) { }

        public DateOnlyConverter(string? serializationFormat)
        {
                this.serializationFormat = serializationFormat ?? "yyyy-MM-dd";
        }

        public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                var value = reader.GetString();
                return DateOnly.Parse(value!);
        }

        public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
                => writer.WriteStringValue(value.ToString(serializationFormat));
    }

    public class TimeOnlyConverter : JsonConverter<TimeOnly>
    {
        private readonly string serializationFormat;

        public TimeOnlyConverter() : this(null) { }

        public TimeOnlyConverter(string? serializationFormat)
        {
                this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff";
        }

        public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                var value = reader.GetString();
                return TimeOnly.Parse(value!);
        }

        public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options)
                => writer.WriteStringValue(value.ToString(serializationFormat));
    }

    internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
    {
        public override bool CanConvert(Type t) => t == typeof(DateTimeOffset);

        private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

        private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind;
        private string? _dateTimeFormat;
        private CultureInfo? _culture;

        public DateTimeStyles DateTimeStyles
        {
                get => _dateTimeStyles;
                set => _dateTimeStyles = value;
        }

        public string? DateTimeFormat
        {
                get => _dateTimeFormat ?? string.Empty;
                set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
        }

        public CultureInfo Culture
        {
                get => _culture ?? CultureInfo.CurrentCulture;
                set => _culture = value;
        }

        public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options)
        {
                string text;


                if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal
                        || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
                {
                        value = value.ToUniversalTime();
                }

                text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);

                writer.WriteStringValue(text);
        }

        public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                string? dateText = reader.GetString();

                if (string.IsNullOrEmpty(dateText) == false)
                {
                        if (!string.IsNullOrEmpty(_dateTimeFormat))
                        {
                                return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
                        }
                        else
                        {
                                return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles);
                        }
                }
                else
                {
                        return default(DateTimeOffset);
                }
        }


        public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter();
    }
}
#pragma warning restore CS8618
#pragma warning restore CS8601
#pragma warning restore CS8602
#pragma warning restore CS8603
// 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:
//
//    corporationRoleGroup, err := UnmarshalCorporationRoleGroup(bytes)
//    bytes, err = corporationRoleGroup.Marshal()

package model

import "encoding/json"

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

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

type CorporationRoleGroup struct {
    Key                int64              `json:"_key"`
    AppliesTo          AppliesTo          `json:"appliesTo"`
    AppliesToGrantable AppliesToGrantable `json:"appliesToGrantable"`
    IsDivisional       bool               `json:"isDivisional"`
    IsLocational       bool               `json:"isLocational"`
    Name               Name               `json:"name"`
}

type Name struct {
    De string `json:"de"`
    En string `json:"en"`
    Es string `json:"es"`
    Fr string `json:"fr"`
    Ja string `json:"ja"`
    Ko string `json:"ko"`
    Ru string `json:"ru"`
    Zh string `json:"zh"`
}

type AppliesTo string

const (
    Roles        AppliesTo = "roles"
    RolesAtBase  AppliesTo = "rolesAtBase"
    RolesAtHQ    AppliesTo = "rolesAtHQ"
    RolesAtOther AppliesTo = "rolesAtOther"
)

type AppliesToGrantable string

const (
    GrantableRoles        AppliesToGrantable = "grantableRoles"
    GrantableRolesAtBase  AppliesToGrantable = "grantableRolesAtBase"
    GrantableRolesAtHQ    AppliesToGrantable = "grantableRolesAtHQ"
    GrantableRolesAtOther AppliesToGrantable = "grantableRolesAtOther"
)
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"_key":{"type":"integer","minimum":1,"maximum":9},"appliesTo":{"type":"string","enum":["roles","rolesAtHQ","rolesAtBase","rolesAtOther"]},"appliesToGrantable":{"type":"string","enum":["grantableRoles","grantableRolesAtHQ","grantableRolesAtBase","grantableRolesAtOther"]},"isDivisional":{"type":"boolean"},"isLocational":{"type":"boolean"},"name":{"type":"object","properties":{"de":{"type":"string","minLength":9,"maxLength":33},"en":{"type":"string","minLength":7,"maxLength":31},"es":{"type":"string","minLength":7,"maxLength":39},"fr":{"type":"string","minLength":11,"maxLength":37},"ja":{"type":"string","minLength":2,"maxLength":12},"ko":{"type":"string","minLength":2,"maxLength":15},"ru":{"type":"string","minLength":5,"maxLength":45},"zh":{"type":"string","minLength":2,"maxLength":9}},"required":["de","en","es","fr","ja","ko","ru","zh"]}},"required":["_key","appliesTo","appliesToGrantable","isDivisional","isLocational","name"]}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json                 = Json { allowStructuredMapKeys = true }
// val corporationRoleGroup = json.parse(CorporationRoleGroup.serializer(), jsonString)

package model

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

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

    val appliesTo: AppliesTo,
    val appliesToGrantable: AppliesToGrantable,
    val isDivisional: Boolean,
    val isLocational: Boolean,
    val name: Name
)

@Serializable
enum class AppliesTo(val value: String) {
    @SerialName("roles") Roles("roles"),
    @SerialName("rolesAtBase") RolesAtBase("rolesAtBase"),
    @SerialName("rolesAtHQ") RolesAtHq("rolesAtHQ"),
    @SerialName("rolesAtOther") RolesAtOther("rolesAtOther");
}

@Serializable
enum class AppliesToGrantable(val value: String) {
    @SerialName("grantableRoles") GrantableRoles("grantableRoles"),
    @SerialName("grantableRolesAtBase") GrantableRolesAtBase("grantableRolesAtBase"),
    @SerialName("grantableRolesAtHQ") GrantableRolesAtHq("grantableRolesAtHQ"),
    @SerialName("grantableRolesAtOther") GrantableRolesAtOther("grantableRolesAtOther");
}

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

// This is an autogenerated file:CorporationRoleGroup

class CorporationRoleGroup {
    private int $key; // json:_key Required
    private AppliesTo $appliesTo; // json:appliesTo Required
    private AppliesToGrantable $appliesToGrantable; // json:appliesToGrantable Required
    private bool $isDivisional; // json:isDivisional Required
    private bool $isLocational; // json:isLocational Required
    private Name $name; // json:name Required

    /**
     * @param int $key
     * @param AppliesTo $appliesTo
     * @param AppliesToGrantable $appliesToGrantable
     * @param bool $isDivisional
     * @param bool $isLocational
     * @param Name $name
     */
    public function __construct(int $key, AppliesTo $appliesTo, AppliesToGrantable $appliesToGrantable, bool $isDivisional, bool $isLocational, Name $name) {
        $this->key = $key;
        $this->appliesTo = $appliesTo;
        $this->appliesToGrantable = $appliesToGrantable;
        $this->isDivisional = $isDivisional;
        $this->isLocational = $isLocational;
        $this->name = $name;
    }

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

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

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

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

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

    /**
     * @param string $value
     * @throws Exception
     * @return AppliesTo
     */
    public static function fromAppliesTo(string $value): AppliesTo {
        return AppliesTo::from($value); /*enum*/
    }

    /**
     * @throws Exception
     * @return string
     */
    public function toAppliesTo(): string {
        if (CorporationRoleGroup::validateAppliesTo($this->appliesTo))  {
            return AppliesTo::to($this->appliesTo); /*enum*/
        }
        throw new Exception('never get to this CorporationRoleGroup::appliesTo');
    }

    /**
     * @param AppliesTo
     * @return bool
     * @throws Exception
     */
    public static function validateAppliesTo(AppliesTo $value): bool {
        AppliesTo::to($value);
        return true;
    }

    /**
     * @throws Exception
     * @return AppliesTo
     */
    public function getAppliesTo(): AppliesTo {
        if (CorporationRoleGroup::validateAppliesTo($this->appliesTo))  {
            return $this->appliesTo;
        }
        throw new Exception('never get to getAppliesTo CorporationRoleGroup::appliesTo');
    }

    /**
     * @return AppliesTo
     */
    public static function sampleAppliesTo(): AppliesTo {
        return AppliesTo::sample(); /*enum*/
    }

    /**
     * @param string $value
     * @throws Exception
     * @return AppliesToGrantable
     */
    public static function fromAppliesToGrantable(string $value): AppliesToGrantable {
        return AppliesToGrantable::from($value); /*enum*/
    }

    /**
     * @throws Exception
     * @return string
     */
    public function toAppliesToGrantable(): string {
        if (CorporationRoleGroup::validateAppliesToGrantable($this->appliesToGrantable))  {
            return AppliesToGrantable::to($this->appliesToGrantable); /*enum*/
        }
        throw new Exception('never get to this CorporationRoleGroup::appliesToGrantable');
    }

    /**
     * @param AppliesToGrantable
     * @return bool
     * @throws Exception
     */
    public static function validateAppliesToGrantable(AppliesToGrantable $value): bool {
        AppliesToGrantable::to($value);
        return true;
    }

    /**
     * @throws Exception
     * @return AppliesToGrantable
     */
    public function getAppliesToGrantable(): AppliesToGrantable {
        if (CorporationRoleGroup::validateAppliesToGrantable($this->appliesToGrantable))  {
            return $this->appliesToGrantable;
        }
        throw new Exception('never get to getAppliesToGrantable CorporationRoleGroup::appliesToGrantable');
    }

    /**
     * @return AppliesToGrantable
     */
    public static function sampleAppliesToGrantable(): AppliesToGrantable {
        return AppliesToGrantable::sample(); /*enum*/
    }

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

    /**
     * @throws Exception
     * @return bool
     */
    public function toIsDivisional(): bool {
        if (CorporationRoleGroup::validateIsDivisional($this->isDivisional))  {
            return $this->isDivisional; /*bool*/
        }
        throw new Exception('never get to this CorporationRoleGroup::isDivisional');
    }

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

    /**
     * @throws Exception
     * @return bool
     */
    public function getIsDivisional(): bool {
        if (CorporationRoleGroup::validateIsDivisional($this->isDivisional))  {
            return $this->isDivisional;
        }
        throw new Exception('never get to getIsDivisional CorporationRoleGroup::isDivisional');
    }

    /**
     * @return bool
     */
    public static function sampleIsDivisional(): bool {
        return true; /*34:isDivisional*/
    }

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

    /**
     * @throws Exception
     * @return bool
     */
    public function toIsLocational(): bool {
        if (CorporationRoleGroup::validateIsLocational($this->isLocational))  {
            return $this->isLocational; /*bool*/
        }
        throw new Exception('never get to this CorporationRoleGroup::isLocational');
    }

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

    /**
     * @throws Exception
     * @return bool
     */
    public function getIsLocational(): bool {
        if (CorporationRoleGroup::validateIsLocational($this->isLocational))  {
            return $this->isLocational;
        }
        throw new Exception('never get to getIsLocational CorporationRoleGroup::isLocational');
    }

    /**
     * @return bool
     */
    public static function sampleIsLocational(): bool {
        return true; /*35:isLocational*/
    }

    /**
     * @param stdClass $value
     * @throws Exception
     * @return Name
     */
    public static function fromName(stdClass $value): Name {
        return Name::from($value); /*class*/
    }

    /**
     * @throws Exception
     * @return stdClass
     */
    public function toName(): stdClass {
        if (CorporationRoleGroup::validateName($this->name))  {
            return $this->name->to(); /*class*/
        }
        throw new Exception('never get to this CorporationRoleGroup::name');
    }

    /**
     * @param Name
     * @return bool
     * @throws Exception
     */
    public static function validateName(Name $value): bool {
        $value->validate();
        return true;
    }

    /**
     * @throws Exception
     * @return Name
     */
    public function getName(): Name {
        if (CorporationRoleGroup::validateName($this->name))  {
            return $this->name;
        }
        throw new Exception('never get to getName CorporationRoleGroup::name');
    }

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

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return CorporationRoleGroup::validateKey($this->key)
        || CorporationRoleGroup::validateAppliesTo($this->appliesTo)
        || CorporationRoleGroup::validateAppliesToGrantable($this->appliesToGrantable)
        || CorporationRoleGroup::validateIsDivisional($this->isDivisional)
        || CorporationRoleGroup::validateIsLocational($this->isLocational)
        || CorporationRoleGroup::validateName($this->name);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'appliesTo'} = $this->toAppliesTo();
        $out->{'appliesToGrantable'} = $this->toAppliesToGrantable();
        $out->{'isDivisional'} = $this->toIsDivisional();
        $out->{'isLocational'} = $this->toIsLocational();
        $out->{'name'} = $this->toName();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return CorporationRoleGroup
     * @throws Exception
     */
    public static function from(stdClass $obj): CorporationRoleGroup {
        return new CorporationRoleGroup(
         CorporationRoleGroup::fromKey($obj->{'_key'})
        ,CorporationRoleGroup::fromAppliesTo($obj->{'appliesTo'})
        ,CorporationRoleGroup::fromAppliesToGrantable($obj->{'appliesToGrantable'})
        ,CorporationRoleGroup::fromIsDivisional($obj->{'isDivisional'})
        ,CorporationRoleGroup::fromIsLocational($obj->{'isLocational'})
        ,CorporationRoleGroup::fromName($obj->{'name'})
        );
    }

    /**
     * @return CorporationRoleGroup
     */
    public static function sample(): CorporationRoleGroup {
        return new CorporationRoleGroup(
         CorporationRoleGroup::sampleKey()
        ,CorporationRoleGroup::sampleAppliesTo()
        ,CorporationRoleGroup::sampleAppliesToGrantable()
        ,CorporationRoleGroup::sampleIsDivisional()
        ,CorporationRoleGroup::sampleIsLocational()
        ,CorporationRoleGroup::sampleName()
        );
    }
}

// This is an autogenerated file:AppliesTo

class AppliesTo {
    public static AppliesTo $ROLES;
    public static AppliesTo $ROLES_AT_BASE;
    public static AppliesTo $ROLES_AT_Hq;
    public static AppliesTo $ROLES_AT_OTHER;
    public static function init() {
        AppliesTo::$ROLES = new AppliesTo('roles');
        AppliesTo::$ROLES_AT_BASE = new AppliesTo('rolesAtBase');
        AppliesTo::$ROLES_AT_Hq = new AppliesTo('rolesAtHQ');
        AppliesTo::$ROLES_AT_OTHER = new AppliesTo('rolesAtOther');
    }
    private string $enum;
    public function __construct(string $enum) {
        $this->enum = $enum;
    }

    /**
     * @param AppliesTo
     * @return string
     * @throws Exception
     */
    public static function to(AppliesTo $obj): string {
        switch ($obj->enum) {
            case AppliesTo::$ROLES->enum: return 'roles';
            case AppliesTo::$ROLES_AT_BASE->enum: return 'rolesAtBase';
            case AppliesTo::$ROLES_AT_Hq->enum: return 'rolesAtHQ';
            case AppliesTo::$ROLES_AT_OTHER->enum: return 'rolesAtOther';
        }
        throw new Exception('the give value is not an enum-value.');
    }

    /**
     * @param mixed
     * @return AppliesTo
     * @throws Exception
     */
    public static function from($obj): AppliesTo {
        switch ($obj) {
            case 'roles': return AppliesTo::$ROLES;
            case 'rolesAtBase': return AppliesTo::$ROLES_AT_BASE;
            case 'rolesAtHQ': return AppliesTo::$ROLES_AT_Hq;
            case 'rolesAtOther': return AppliesTo::$ROLES_AT_OTHER;
        }
        throw new Exception("Cannot deserialize AppliesTo");
    }

    /**
     * @return AppliesTo
     */
    public static function sample(): AppliesTo {
        return AppliesTo::$ROLES;
    }
}
AppliesTo::init();

// This is an autogenerated file:AppliesToGrantable

class AppliesToGrantable {
    public static AppliesToGrantable $GRANTABLE_ROLES;
    public static AppliesToGrantable $GRANTABLE_ROLES_AT_BASE;
    public static AppliesToGrantable $GRANTABLE_ROLES_AT_Hq;
    public static AppliesToGrantable $GRANTABLE_ROLES_AT_OTHER;
    public static function init() {
        AppliesToGrantable::$GRANTABLE_ROLES = new AppliesToGrantable('grantableRoles');
        AppliesToGrantable::$GRANTABLE_ROLES_AT_BASE = new AppliesToGrantable('grantableRolesAtBase');
        AppliesToGrantable::$GRANTABLE_ROLES_AT_Hq = new AppliesToGrantable('grantableRolesAtHQ');
        AppliesToGrantable::$GRANTABLE_ROLES_AT_OTHER = new AppliesToGrantable('grantableRolesAtOther');
    }
    private string $enum;
    public function __construct(string $enum) {
        $this->enum = $enum;
    }

    /**
     * @param AppliesToGrantable
     * @return string
     * @throws Exception
     */
    public static function to(AppliesToGrantable $obj): string {
        switch ($obj->enum) {
            case AppliesToGrantable::$GRANTABLE_ROLES->enum: return 'grantableRoles';
            case AppliesToGrantable::$GRANTABLE_ROLES_AT_BASE->enum: return 'grantableRolesAtBase';
            case AppliesToGrantable::$GRANTABLE_ROLES_AT_Hq->enum: return 'grantableRolesAtHQ';
            case AppliesToGrantable::$GRANTABLE_ROLES_AT_OTHER->enum: return 'grantableRolesAtOther';
        }
        throw new Exception('the give value is not an enum-value.');
    }

    /**
     * @param mixed
     * @return AppliesToGrantable
     * @throws Exception
     */
    public static function from($obj): AppliesToGrantable {
        switch ($obj) {
            case 'grantableRoles': return AppliesToGrantable::$GRANTABLE_ROLES;
            case 'grantableRolesAtBase': return AppliesToGrantable::$GRANTABLE_ROLES_AT_BASE;
            case 'grantableRolesAtHQ': return AppliesToGrantable::$GRANTABLE_ROLES_AT_Hq;
            case 'grantableRolesAtOther': return AppliesToGrantable::$GRANTABLE_ROLES_AT_OTHER;
        }
        throw new Exception("Cannot deserialize AppliesToGrantable");
    }

    /**
     * @return AppliesToGrantable
     */
    public static function sample(): AppliesToGrantable {
        return AppliesToGrantable::$GRANTABLE_ROLES;
    }
}
AppliesToGrantable::init();

// This is an autogenerated file:Name

class Name {
    private string $de; // json:de Required
    private string $en; // json:en Required
    private string $es; // json:es Required
    private string $fr; // json:fr Required
    private string $ja; // json:ja Required
    private string $ko; // json:ko Required
    private string $ru; // json:ru Required
    private string $zh; // json:zh Required

    /**
     * @param string $de
     * @param string $en
     * @param string $es
     * @param string $fr
     * @param string $ja
     * @param string $ko
     * @param string $ru
     * @param string $zh
     */
    public function __construct(string $de, string $en, string $es, string $fr, string $ja, string $ko, string $ru, string $zh) {
        $this->de = $de;
        $this->en = $en;
        $this->es = $es;
        $this->fr = $fr;
        $this->ja = $ja;
        $this->ko = $ko;
        $this->ru = $ru;
        $this->zh = $zh;
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toDe(): string {
        if (Name::validateDe($this->de))  {
            return $this->de; /*string*/
        }
        throw new Exception('never get to this Name::de');
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function getDe(): string {
        if (Name::validateDe($this->de))  {
            return $this->de;
        }
        throw new Exception('never get to getDe Name::de');
    }

    /**
     * @return string
     */
    public static function sampleDe(): string {
        return 'Name::de::31'; /*31:de*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toEn(): string {
        if (Name::validateEn($this->en))  {
            return $this->en; /*string*/
        }
        throw new Exception('never get to this Name::en');
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function getEn(): string {
        if (Name::validateEn($this->en))  {
            return $this->en;
        }
        throw new Exception('never get to getEn Name::en');
    }

    /**
     * @return string
     */
    public static function sampleEn(): string {
        return 'Name::en::32'; /*32:en*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toEs(): string {
        if (Name::validateEs($this->es))  {
            return $this->es; /*string*/
        }
        throw new Exception('never get to this Name::es');
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function getEs(): string {
        if (Name::validateEs($this->es))  {
            return $this->es;
        }
        throw new Exception('never get to getEs Name::es');
    }

    /**
     * @return string
     */
    public static function sampleEs(): string {
        return 'Name::es::33'; /*33:es*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toFr(): string {
        if (Name::validateFr($this->fr))  {
            return $this->fr; /*string*/
        }
        throw new Exception('never get to this Name::fr');
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function getFr(): string {
        if (Name::validateFr($this->fr))  {
            return $this->fr;
        }
        throw new Exception('never get to getFr Name::fr');
    }

    /**
     * @return string
     */
    public static function sampleFr(): string {
        return 'Name::fr::34'; /*34:fr*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toJa(): string {
        if (Name::validateJa($this->ja))  {
            return $this->ja; /*string*/
        }
        throw new Exception('never get to this Name::ja');
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function getJa(): string {
        if (Name::validateJa($this->ja))  {
            return $this->ja;
        }
        throw new Exception('never get to getJa Name::ja');
    }

    /**
     * @return string
     */
    public static function sampleJa(): string {
        return 'Name::ja::35'; /*35:ja*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toKo(): string {
        if (Name::validateKo($this->ko))  {
            return $this->ko; /*string*/
        }
        throw new Exception('never get to this Name::ko');
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function getKo(): string {
        if (Name::validateKo($this->ko))  {
            return $this->ko;
        }
        throw new Exception('never get to getKo Name::ko');
    }

    /**
     * @return string
     */
    public static function sampleKo(): string {
        return 'Name::ko::36'; /*36:ko*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toRu(): string {
        if (Name::validateRu($this->ru))  {
            return $this->ru; /*string*/
        }
        throw new Exception('never get to this Name::ru');
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function getRu(): string {
        if (Name::validateRu($this->ru))  {
            return $this->ru;
        }
        throw new Exception('never get to getRu Name::ru');
    }

    /**
     * @return string
     */
    public static function sampleRu(): string {
        return 'Name::ru::37'; /*37:ru*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toZh(): string {
        if (Name::validateZh($this->zh))  {
            return $this->zh; /*string*/
        }
        throw new Exception('never get to this Name::zh');
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function getZh(): string {
        if (Name::validateZh($this->zh))  {
            return $this->zh;
        }
        throw new Exception('never get to getZh Name::zh');
    }

    /**
     * @return string
     */
    public static function sampleZh(): string {
        return 'Name::zh::38'; /*38:zh*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return Name::validateDe($this->de)
        || Name::validateEn($this->en)
        || Name::validateEs($this->es)
        || Name::validateFr($this->fr)
        || Name::validateJa($this->ja)
        || Name::validateKo($this->ko)
        || Name::validateRu($this->ru)
        || Name::validateZh($this->zh);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'de'} = $this->toDe();
        $out->{'en'} = $this->toEn();
        $out->{'es'} = $this->toEs();
        $out->{'fr'} = $this->toFr();
        $out->{'ja'} = $this->toJa();
        $out->{'ko'} = $this->toKo();
        $out->{'ru'} = $this->toRu();
        $out->{'zh'} = $this->toZh();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return Name
     * @throws Exception
     */
    public static function from(stdClass $obj): Name {
        return new Name(
         Name::fromDe($obj->{'de'})
        ,Name::fromEn($obj->{'en'})
        ,Name::fromEs($obj->{'es'})
        ,Name::fromFr($obj->{'fr'})
        ,Name::fromJa($obj->{'ja'})
        ,Name::fromKo($obj->{'ko'})
        ,Name::fromRu($obj->{'ru'})
        ,Name::fromZh($obj->{'zh'})
        );
    }

    /**
     * @return Name
     */
    public static function sample(): Name {
        return new Name(
         Name::sampleDe()
        ,Name::sampleEn()
        ,Name::sampleEs()
        ,Name::sampleFr()
        ,Name::sampleJa()
        ,Name::sampleKo()
        ,Name::sampleRu()
        ,Name::sampleZh()
        );
    }
}
from enum import Enum
from dataclasses import dataclass
from typing import Any, TypeVar, Type, cast


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


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


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


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


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


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


class AppliesTo(Enum):
    ROLES = "roles"
    ROLES_AT_BASE = "rolesAtBase"
    ROLES_AT_HQ = "rolesAtHQ"
    ROLES_AT_OTHER = "rolesAtOther"


class AppliesToGrantable(Enum):
    GRANTABLE_ROLES = "grantableRoles"
    GRANTABLE_ROLES_AT_BASE = "grantableRolesAtBase"
    GRANTABLE_ROLES_AT_HQ = "grantableRolesAtHQ"
    GRANTABLE_ROLES_AT_OTHER = "grantableRolesAtOther"


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

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

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


@dataclass
class CorporationRoleGroup:
    key: int
    applies_to: AppliesTo
    applies_to_grantable: AppliesToGrantable
    is_divisional: bool
    is_locational: bool
    name: Name

    @staticmethod
    def from_dict(obj: Any) -> 'CorporationRoleGroup':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        applies_to = AppliesTo(obj.get("appliesTo"))
        applies_to_grantable = AppliesToGrantable(obj.get("appliesToGrantable"))
        is_divisional = from_bool(obj.get("isDivisional"))
        is_locational = from_bool(obj.get("isLocational"))
        name = Name.from_dict(obj.get("name"))
        return CorporationRoleGroup(key, applies_to, applies_to_grantable, is_divisional, is_locational, name)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["appliesTo"] = to_enum(AppliesTo, self.applies_to)
        result["appliesToGrantable"] = to_enum(AppliesToGrantable, self.applies_to_grantable)
        result["isDivisional"] = from_bool(self.is_divisional)
        result["isLocational"] = from_bool(self.is_locational)
        result["name"] = to_class(Name, self.name)
        return result


def corporation_role_group_from_dict(s: Any) -> CorporationRoleGroup:
    return CorporationRoleGroup.from_dict(s)


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

export interface CorporationRoleGroup {
    _key:               number;
    appliesTo:          AppliesTo;
    appliesToGrantable: AppliesToGrantable;
    isDivisional:       boolean;
    isLocational:       boolean;
    name:               Name;
    [property: string]: unknown;
}

export type AppliesTo = "roles" | "rolesAtHQ" | "rolesAtBase" | "rolesAtOther";

export type AppliesToGrantable = "grantableRoles" | "grantableRolesAtHQ" | "grantableRolesAtBase" | "grantableRolesAtOther";

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

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

    public static corporationRoleGroupToJson(value: CorporationRoleGroup): string {
        return JSON.stringify(uncast(value, r("CorporationRoleGroup")), 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 = {
    "CorporationRoleGroup": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "appliesTo", js: "appliesTo", typ: r("AppliesTo") },
        { json: "appliesToGrantable", js: "appliesToGrantable", typ: r("AppliesToGrantable") },
        { json: "isDivisional", js: "isDivisional", typ: true },
        { json: "isLocational", js: "isLocational", typ: true },
        { json: "name", js: "name", typ: r("Name") },
    ], "any"),
    "Name": o([
        { json: "de", js: "de", typ: "" },
        { json: "en", js: "en", typ: "" },
        { json: "es", js: "es", typ: "" },
        { json: "fr", js: "fr", typ: "" },
        { json: "ja", js: "ja", typ: "" },
        { json: "ko", js: "ko", typ: "" },
        { json: "ru", js: "ru", typ: "" },
        { json: "zh", js: "zh", typ: "" },
    ], "any"),
    "AppliesTo": [
        "roles",
        "rolesAtBase",
        "rolesAtHQ",
        "rolesAtOther",
    ],
    "AppliesToGrantable": [
        "grantableRoles",
        "grantableRolesAtBase",
        "grantableRolesAtHQ",
        "grantableRolesAtOther",
    ],
};