Skip to content

EVE SDE Schema

Documentation for third-party developers

proximityTrap.jsonl

Schema

  • _key (required): integer
    Range: 57556 .. 93850
  • dbuffDuration (required): integer
    Range: 0 .. 60
  • dbuffs: array of object

    • _key (required): integer
      Range: 2147 .. 2418
    • _value (required): number
      Range: -75 .. 200
  • forceDecloakDuration: integer
    Range: 60 .. 60

  • resetDelay: integer
    Range: 60 .. 60
  • showPerimeterLights (required): boolean
  • triggerDelay (required): integer
    Range: 1 .. 1
  • triggerFilterTypeListID (required): integer
    Range: 27 .. 27
  • triggerRange (required): integer
    Range: 5000 .. 25000

Code snippets

// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
//    using QuickType;
//
//    var proximityTrap = ProximityTrap.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 ProximityTrap
    {
        [JsonPropertyName("_key")]
        public long Key { get; set; }

        [JsonPropertyName("dbuffDuration")]
        public long DbuffDuration { get; set; }

        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("dbuffs")]
        public Dbuff[]? Dbuffs { get; set; }

        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("forceDecloakDuration")]
        public long? ForceDecloakDuration { get; set; }

        [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
        [JsonPropertyName("resetDelay")]
        public long? ResetDelay { get; set; }

        [JsonPropertyName("showPerimeterLights")]
        public bool ShowPerimeterLights { get; set; }

        [JsonPropertyName("triggerDelay")]
        public long TriggerDelay { get; set; }

        [JsonPropertyName("triggerFilterTypeListID")]
        public long TriggerFilterTypeListId { get; set; }

        [JsonPropertyName("triggerRange")]
        public long TriggerRange { get; set; }
    }

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

        [JsonPropertyName("_value")]
        [JsonConverter(typeof(MinMaxValueCheckConverter))]
        public double Value { get; set; }
    }

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

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

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

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

        public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetDouble();
            if (value >= -75 && value <= 200)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type double");
        }

        public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
        {
            if (value >= -75 && value <= 200)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type double");
        }

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

    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:
//
//    proximityTrap, err := UnmarshalProximityTrap(bytes)
//    bytes, err = proximityTrap.Marshal()

package model

import "encoding/json"

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

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

type ProximityTrap struct {
    Key                     int64   `json:"_key"`
    DbuffDuration           int64   `json:"dbuffDuration"`
    Dbuffs                  []Dbuff `json:"dbuffs,omitempty"`
    ForceDecloakDuration    *int64  `json:"forceDecloakDuration,omitempty"`
    ResetDelay              *int64  `json:"resetDelay,omitempty"`
    ShowPerimeterLights     bool    `json:"showPerimeterLights"`
    TriggerDelay            int64   `json:"triggerDelay"`
    TriggerFilterTypeListID int64   `json:"triggerFilterTypeListID"`
    TriggerRange            int64   `json:"triggerRange"`
}

type Dbuff struct {
    Key   int64   `json:"_key"`
    Value float64 `json:"_value"`
}
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"_key":{"type":"integer","minimum":57556,"maximum":93850},"dbuffDuration":{"type":"integer","minimum":0,"maximum":60},"dbuffs":{"type":"array","items":{"type":"object","properties":{"_key":{"type":"integer","minimum":2147,"maximum":2418},"_value":{"type":"number","minimum":-75.0,"maximum":200.0}},"required":["_key","_value"]},"minItems":5,"maxItems":5},"forceDecloakDuration":{"type":"integer","minimum":60,"maximum":60},"resetDelay":{"type":"integer","minimum":60,"maximum":60},"showPerimeterLights":{"type":"boolean"},"triggerDelay":{"type":"integer","minimum":1,"maximum":1},"triggerFilterTypeListID":{"type":"integer","minimum":27,"maximum":27},"triggerRange":{"type":"integer","minimum":5000,"maximum":25000}},"required":["_key","dbuffDuration","showPerimeterLights","triggerDelay","triggerFilterTypeListID","triggerRange"]}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json          = Json { allowStructuredMapKeys = true }
// val proximityTrap = json.parse(ProximityTrap.serializer(), jsonString)

package model

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

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

    val dbuffDuration: Long,
    val dbuffs: List<Dbuff>? = null,
    val forceDecloakDuration: Long? = null,
    val resetDelay: Long? = null,
    val showPerimeterLights: Boolean,
    val triggerDelay: Long,

    @SerialName("triggerFilterTypeListID")
    val triggerFilterTypeListId: Long,

    val triggerRange: Long
)

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

    @SerialName("_value")
    val value: Double
)
<?php

// This is an autogenerated file:ProximityTrap

class ProximityTrap {
    private int $key; // json:_key Required
    private int $dbuffDuration; // json:dbuffDuration Required
    private ?array $dbuffs; // json:dbuffs Optional
    private ?int $forceDecloakDuration; // json:forceDecloakDuration Optional
    private ?int $resetDelay; // json:resetDelay Optional
    private bool $showPerimeterLights; // json:showPerimeterLights Required
    private int $triggerDelay; // json:triggerDelay Required
    private int $triggerFilterTypeListId; // json:triggerFilterTypeListID Required
    private int $triggerRange; // json:triggerRange Required

    /**
     * @param int $key
     * @param int $dbuffDuration
     * @param array|null $dbuffs
     * @param int|null $forceDecloakDuration
     * @param int|null $resetDelay
     * @param bool $showPerimeterLights
     * @param int $triggerDelay
     * @param int $triggerFilterTypeListId
     * @param int $triggerRange
     */
    public function __construct(int $key, int $dbuffDuration, ?array $dbuffs, ?int $forceDecloakDuration, ?int $resetDelay, bool $showPerimeterLights, int $triggerDelay, int $triggerFilterTypeListId, int $triggerRange) {
        $this->key = $key;
        $this->dbuffDuration = $dbuffDuration;
        $this->dbuffs = $dbuffs;
        $this->forceDecloakDuration = $forceDecloakDuration;
        $this->resetDelay = $resetDelay;
        $this->showPerimeterLights = $showPerimeterLights;
        $this->triggerDelay = $triggerDelay;
        $this->triggerFilterTypeListId = $triggerFilterTypeListId;
        $this->triggerRange = $triggerRange;
    }

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

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

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

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

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

    /**
     * @throws Exception
     * @return int
     */
    public function toDbuffDuration(): int {
        if (ProximityTrap::validateDbuffDuration($this->dbuffDuration))  {
            return $this->dbuffDuration; /*int*/
        }
        throw new Exception('never get to this ProximityTrap::dbuffDuration');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getDbuffDuration(): int {
        if (ProximityTrap::validateDbuffDuration($this->dbuffDuration))  {
            return $this->dbuffDuration;
        }
        throw new Exception('never get to getDbuffDuration ProximityTrap::dbuffDuration');
    }

    /**
     * @return int
     */
    public static function sampleDbuffDuration(): int {
        return 32; /*32:dbuffDuration*/
    }

    /**
     * @param ?array $value
     * @throws Exception
     * @return ?array
     */
    public static function fromDbuffs(?array $value): ?array {
        if (!is_null($value)) {
            return  array_map(function ($value) {
                return Dbuff::from($value); /*class*/
            }, $value);
        } else {
            return  null;
        }
    }

    /**
     * @throws Exception
     * @return ?array
     */
    public function toDbuffs(): ?array {
        if (ProximityTrap::validateDbuffs($this->dbuffs))  {
            if (!is_null($this->dbuffs)) {
                return array_map(function ($value) {
                    return $value->to(); /*class*/
                }, $this->dbuffs);
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this ProximityTrap::dbuffs');
    }

    /**
     * @param array|null
     * @return bool
     * @throws Exception
     */
    public static function validateDbuffs(?array $value): bool {
        if (!is_null($value)) {
            if (!is_array($value)) {
                throw new Exception("Attribute Error:ProximityTrap::dbuffs");
            }
            array_walk($value, function($value_v) {
                $value_v->validate();
            });
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?array
     */
    public function getDbuffs(): ?array {
        if (ProximityTrap::validateDbuffs($this->dbuffs))  {
            return $this->dbuffs;
        }
        throw new Exception('never get to getDbuffs ProximityTrap::dbuffs');
    }

    /**
     * @return ?array
     */
    public static function sampleDbuffs(): ?array {
        return  array(
            Dbuff::sample() /*33:*/
        ); /* 33:dbuffs*/
    }

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

    /**
     * @throws Exception
     * @return ?int
     */
    public function toForceDecloakDuration(): ?int {
        if (ProximityTrap::validateForceDecloakDuration($this->forceDecloakDuration))  {
            if (!is_null($this->forceDecloakDuration)) {
                return $this->forceDecloakDuration; /*int*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this ProximityTrap::forceDecloakDuration');
    }

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

    /**
     * @throws Exception
     * @return ?int
     */
    public function getForceDecloakDuration(): ?int {
        if (ProximityTrap::validateForceDecloakDuration($this->forceDecloakDuration))  {
            return $this->forceDecloakDuration;
        }
        throw new Exception('never get to getForceDecloakDuration ProximityTrap::forceDecloakDuration');
    }

    /**
     * @return ?int
     */
    public static function sampleForceDecloakDuration(): ?int {
        return 34; /*34:forceDecloakDuration*/
    }

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

    /**
     * @throws Exception
     * @return ?int
     */
    public function toResetDelay(): ?int {
        if (ProximityTrap::validateResetDelay($this->resetDelay))  {
            if (!is_null($this->resetDelay)) {
                return $this->resetDelay; /*int*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this ProximityTrap::resetDelay');
    }

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

    /**
     * @throws Exception
     * @return ?int
     */
    public function getResetDelay(): ?int {
        if (ProximityTrap::validateResetDelay($this->resetDelay))  {
            return $this->resetDelay;
        }
        throw new Exception('never get to getResetDelay ProximityTrap::resetDelay');
    }

    /**
     * @return ?int
     */
    public static function sampleResetDelay(): ?int {
        return 35; /*35:resetDelay*/
    }

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

    /**
     * @throws Exception
     * @return bool
     */
    public function toShowPerimeterLights(): bool {
        if (ProximityTrap::validateShowPerimeterLights($this->showPerimeterLights))  {
            return $this->showPerimeterLights; /*bool*/
        }
        throw new Exception('never get to this ProximityTrap::showPerimeterLights');
    }

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

    /**
     * @throws Exception
     * @return bool
     */
    public function getShowPerimeterLights(): bool {
        if (ProximityTrap::validateShowPerimeterLights($this->showPerimeterLights))  {
            return $this->showPerimeterLights;
        }
        throw new Exception('never get to getShowPerimeterLights ProximityTrap::showPerimeterLights');
    }

    /**
     * @return bool
     */
    public static function sampleShowPerimeterLights(): bool {
        return true; /*36:showPerimeterLights*/
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function toTriggerDelay(): int {
        if (ProximityTrap::validateTriggerDelay($this->triggerDelay))  {
            return $this->triggerDelay; /*int*/
        }
        throw new Exception('never get to this ProximityTrap::triggerDelay');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getTriggerDelay(): int {
        if (ProximityTrap::validateTriggerDelay($this->triggerDelay))  {
            return $this->triggerDelay;
        }
        throw new Exception('never get to getTriggerDelay ProximityTrap::triggerDelay');
    }

    /**
     * @return int
     */
    public static function sampleTriggerDelay(): int {
        return 37; /*37:triggerDelay*/
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function toTriggerFilterTypeListId(): int {
        if (ProximityTrap::validateTriggerFilterTypeListId($this->triggerFilterTypeListId))  {
            return $this->triggerFilterTypeListId; /*int*/
        }
        throw new Exception('never get to this ProximityTrap::triggerFilterTypeListId');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getTriggerFilterTypeListId(): int {
        if (ProximityTrap::validateTriggerFilterTypeListId($this->triggerFilterTypeListId))  {
            return $this->triggerFilterTypeListId;
        }
        throw new Exception('never get to getTriggerFilterTypeListId ProximityTrap::triggerFilterTypeListId');
    }

    /**
     * @return int
     */
    public static function sampleTriggerFilterTypeListId(): int {
        return 38; /*38:triggerFilterTypeListId*/
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function toTriggerRange(): int {
        if (ProximityTrap::validateTriggerRange($this->triggerRange))  {
            return $this->triggerRange; /*int*/
        }
        throw new Exception('never get to this ProximityTrap::triggerRange');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getTriggerRange(): int {
        if (ProximityTrap::validateTriggerRange($this->triggerRange))  {
            return $this->triggerRange;
        }
        throw new Exception('never get to getTriggerRange ProximityTrap::triggerRange');
    }

    /**
     * @return int
     */
    public static function sampleTriggerRange(): int {
        return 39; /*39:triggerRange*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return ProximityTrap::validateKey($this->key)
        || ProximityTrap::validateDbuffDuration($this->dbuffDuration)
        || ProximityTrap::validateDbuffs($this->dbuffs)
        || ProximityTrap::validateForceDecloakDuration($this->forceDecloakDuration)
        || ProximityTrap::validateResetDelay($this->resetDelay)
        || ProximityTrap::validateShowPerimeterLights($this->showPerimeterLights)
        || ProximityTrap::validateTriggerDelay($this->triggerDelay)
        || ProximityTrap::validateTriggerFilterTypeListId($this->triggerFilterTypeListId)
        || ProximityTrap::validateTriggerRange($this->triggerRange);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'dbuffDuration'} = $this->toDbuffDuration();
        $out->{'dbuffs'} = $this->toDbuffs();
        $out->{'forceDecloakDuration'} = $this->toForceDecloakDuration();
        $out->{'resetDelay'} = $this->toResetDelay();
        $out->{'showPerimeterLights'} = $this->toShowPerimeterLights();
        $out->{'triggerDelay'} = $this->toTriggerDelay();
        $out->{'triggerFilterTypeListID'} = $this->toTriggerFilterTypeListId();
        $out->{'triggerRange'} = $this->toTriggerRange();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return ProximityTrap
     * @throws Exception
     */
    public static function from(stdClass $obj): ProximityTrap {
        return new ProximityTrap(
         ProximityTrap::fromKey($obj->{'_key'})
        ,ProximityTrap::fromDbuffDuration($obj->{'dbuffDuration'})
        ,ProximityTrap::fromDbuffs($obj->{'dbuffs'})
        ,ProximityTrap::fromForceDecloakDuration($obj->{'forceDecloakDuration'})
        ,ProximityTrap::fromResetDelay($obj->{'resetDelay'})
        ,ProximityTrap::fromShowPerimeterLights($obj->{'showPerimeterLights'})
        ,ProximityTrap::fromTriggerDelay($obj->{'triggerDelay'})
        ,ProximityTrap::fromTriggerFilterTypeListId($obj->{'triggerFilterTypeListID'})
        ,ProximityTrap::fromTriggerRange($obj->{'triggerRange'})
        );
    }

    /**
     * @return ProximityTrap
     */
    public static function sample(): ProximityTrap {
        return new ProximityTrap(
         ProximityTrap::sampleKey()
        ,ProximityTrap::sampleDbuffDuration()
        ,ProximityTrap::sampleDbuffs()
        ,ProximityTrap::sampleForceDecloakDuration()
        ,ProximityTrap::sampleResetDelay()
        ,ProximityTrap::sampleShowPerimeterLights()
        ,ProximityTrap::sampleTriggerDelay()
        ,ProximityTrap::sampleTriggerFilterTypeListId()
        ,ProximityTrap::sampleTriggerRange()
        );
    }
}

// This is an autogenerated file:Dbuff

class Dbuff {
    private int $key; // json:_key Required
    private float $value; // json:_value Required

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

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

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

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

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

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

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

    /**
     * @throws Exception
     * @return float
     */
    public function toValue(): float {
        if (Dbuff::validateValue($this->value))  {
            return $this->value; /*float*/
        }
        throw new Exception('never get to this Dbuff::value');
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function getValue(): float {
        if (Dbuff::validateValue($this->value))  {
            return $this->value;
        }
        throw new Exception('never get to getValue Dbuff::value');
    }

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

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return Dbuff::validateKey($this->key)
        || Dbuff::validateValue($this->value);
    }

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

    /**
     * @param stdClass $obj
     * @return Dbuff
     * @throws Exception
     */
    public static function from(stdClass $obj): Dbuff {
        return new Dbuff(
         Dbuff::fromKey($obj->{'_key'})
        ,Dbuff::fromValue($obj->{'_value'})
        );
    }

    /**
     * @return Dbuff
     */
    public static function sample(): Dbuff {
        return new Dbuff(
         Dbuff::sampleKey()
        ,Dbuff::sampleValue()
        );
    }
}
from dataclasses import dataclass
from typing import Any, TypeVar, Callable, Type, cast


T = TypeVar("T")


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


def from_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_bool(x: Any) -> bool:
    assert isinstance(x, bool)
    return x


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


def 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 to_class(c: Type[T], x: Any) -> dict:
    assert isinstance(x, c)
    return cast(Any, x).to_dict()


@dataclass
class Dbuff:
    key: int
    value: float

    @staticmethod
    def from_dict(obj: Any) -> 'Dbuff':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        value = from_float(obj.get("_value"))
        return Dbuff(key, value)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["_value"] = to_float(self.value)
        return result


@dataclass
class ProximityTrap:
    key: int
    dbuff_duration: int
    show_perimeter_lights: bool
    trigger_delay: int
    trigger_filter_type_list_id: int
    trigger_range: int
    dbuffs: list[Dbuff] | None = None
    force_decloak_duration: int | None = None
    reset_delay: int | None = None

    @staticmethod
    def from_dict(obj: Any) -> 'ProximityTrap':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        dbuff_duration = from_int(obj.get("dbuffDuration"))
        show_perimeter_lights = from_bool(obj.get("showPerimeterLights"))
        trigger_delay = from_int(obj.get("triggerDelay"))
        trigger_filter_type_list_id = from_int(obj.get("triggerFilterTypeListID"))
        trigger_range = from_int(obj.get("triggerRange"))
        dbuffs = from_union([lambda x: from_list(Dbuff.from_dict, x), from_none], obj.get("dbuffs"))
        force_decloak_duration = from_union([from_int, from_none], obj.get("forceDecloakDuration"))
        reset_delay = from_union([from_int, from_none], obj.get("resetDelay"))
        return ProximityTrap(key, dbuff_duration, show_perimeter_lights, trigger_delay, trigger_filter_type_list_id, trigger_range, dbuffs, force_decloak_duration, reset_delay)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["dbuffDuration"] = from_int(self.dbuff_duration)
        result["showPerimeterLights"] = from_bool(self.show_perimeter_lights)
        result["triggerDelay"] = from_int(self.trigger_delay)
        result["triggerFilterTypeListID"] = from_int(self.trigger_filter_type_list_id)
        result["triggerRange"] = from_int(self.trigger_range)
        if self.dbuffs is not None:
            result["dbuffs"] = from_union([lambda x: from_list(lambda x: to_class(Dbuff, x), x), from_none], self.dbuffs)
        if self.force_decloak_duration is not None:
            result["forceDecloakDuration"] = from_union([from_int, from_none], self.force_decloak_duration)
        if self.reset_delay is not None:
            result["resetDelay"] = from_union([from_int, from_none], self.reset_delay)
        return result


def proximity_trap_from_dict(s: Any) -> ProximityTrap:
    return ProximityTrap.from_dict(s)


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

export interface ProximityTrap {
    _key:                    number;
    dbuffDuration:           number;
    dbuffs?:                 [Dbuff, Dbuff, Dbuff, Dbuff, Dbuff, ...Dbuff[]];
    forceDecloakDuration?:   number;
    resetDelay?:             number;
    showPerimeterLights:     boolean;
    triggerDelay:            number;
    triggerFilterTypeListID: number;
    triggerRange:            number;
    [property: string]: unknown;
}

export interface Dbuff {
    _key:   number;
    _value: number;
    [property: string]: unknown;
}

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

    public static proximityTrapToJson(value: ProximityTrap): string {
        return JSON.stringify(uncast(value, r("ProximityTrap")), 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 = {
    "ProximityTrap": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "dbuffDuration", js: "dbuffDuration", typ: 0 },
        { json: "dbuffs", js: "dbuffs", typ: u(undefined, a(r("Dbuff"))) },
        { json: "forceDecloakDuration", js: "forceDecloakDuration", typ: u(undefined, 0) },
        { json: "resetDelay", js: "resetDelay", typ: u(undefined, 0) },
        { json: "showPerimeterLights", js: "showPerimeterLights", typ: true },
        { json: "triggerDelay", js: "triggerDelay", typ: 0 },
        { json: "triggerFilterTypeListID", js: "triggerFilterTypeListID", typ: 0 },
        { json: "triggerRange", js: "triggerRange", typ: 0 },
    ], "any"),
    "Dbuff": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "_value", js: "_value", typ: 3.14 },
    ], "any"),
};