// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
//    using FModel.Parser.Weapons;
//
//    var weaponStatParser = WeaponStatParser.FromJson(jsonString);

namespace FModel.Parser.Weapons
{
    using System;

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

    public partial class WeaponStatParser
    {
        [JsonProperty("export_type")]
        public string ExportType { get; set; }

        [JsonProperty("Spread")]
        public double Spread { get; set; }

        [JsonProperty("SpreadDownsights")]
        public double SpreadDownsights { get; set; }

        [JsonProperty("StandingStillSpreadMultiplier")]
        public double StandingStillSpreadMultiplier { get; set; }

        [JsonProperty("AthenaCrouchingSpreadMultiplier")]
        public double AthenaCrouchingSpreadMultiplier { get; set; }

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

        [JsonProperty("AthenaSprintingSpreadMultiplier")]
        public double AthenaSprintingSpreadMultiplier { get; set; }

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

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

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

        [JsonProperty("HeatX1")]
        public double HeatX1 { get; set; }

        [JsonProperty("HeatY1")]
        public double HeatY1 { get; set; }

        [JsonProperty("HeatX2")]
        public double HeatX2 { get; set; }

        [JsonProperty("HeatY2")]
        public double HeatY2 { get; set; }

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

        [JsonProperty("HeatY3")]
        public double HeatY3 { get; set; }

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

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

        [JsonProperty("CoolX1")]
        public double CoolX1 { get; set; }

        [JsonProperty("CoolY1")]
        public double CoolY1 { get; set; }

        [JsonProperty("CoolX2")]
        public double CoolX2 { get; set; }

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

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

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

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

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

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

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

        [JsonProperty("FiringRate")]
        public double FiringRate { get; set; }

        [JsonProperty("ROFScale")]
        public long RofScale { get; set; }

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

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

        [JsonProperty("AutofireAcquisitionDelay")]
        public double AutofireAcquisitionDelay { get; set; }

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

        [JsonProperty("RecoilVert")]
        public double RecoilVert { get; set; }

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

        [JsonProperty("RecoilVertScaleGamepad")]
        public double RecoilVertScaleGamepad { get; set; }

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

        [JsonProperty("RecoilHoriz")]
        public double RecoilHoriz { get; set; }

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

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

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

        [JsonProperty("RecoilRecoveryInterpSpeed")]
        public double RecoilRecoveryInterpSpeed { get; set; }

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

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

        [JsonProperty("RecoilDownsightsMultiplier")]
        public double RecoilDownsightsMultiplier { get; set; }

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

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

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

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

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

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

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

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

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

        [JsonProperty("AthenaRecoilDownsightsMultiplier")]
        public double AthenaRecoilDownsightsMultiplier { get; set; }

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

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

        [JsonProperty("ADSTransitionInTime")]
        public double AdsTransitionInTime { get; set; }

        [JsonProperty("ADSTransitionOutTime")]
        public double AdsTransitionOutTime { get; set; }

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

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

        [JsonProperty("AIDelayBeforeFiringMin")]
        public long AiDelayBeforeFiringMin { get; set; }

        [JsonProperty("AIDelayBeforeFiringMax")]
        public double AiDelayBeforeFiringMax { get; set; }

        [JsonProperty("AIFireDurationMin")]
        public double AiFireDurationMin { get; set; }

        [JsonProperty("AIFireDurationMax")]
        public double AiFireDurationMax { get; set; }

        [JsonProperty("AIMinSpreadDuration")]
        public long AiMinSpreadDuration { get; set; }

        [JsonProperty("AIMaxSpreadDuration")]
        public long AiMaxSpreadDuration { get; set; }

        [JsonProperty("AIDurationSpreadMultiplier")]
        public long AiDurationSpreadMultiplier { get; set; }

        [JsonProperty("AIAdditionalSpreadForTargetMovingLaterally")]
        public long AiAdditionalSpreadForTargetMovingLaterally { get; set; }

        [JsonProperty("AIAthenaHearFiringNoiseRange")]
        public long AiAthenaHearFiringNoiseRange { get; set; }

        [JsonProperty("EQSDensity")]
        public long EqsDensity { get; set; }

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

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

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

        [JsonProperty("MinPreferredRangeEQS")]
        public long MinPreferredRangeEqs { get; set; }

        [JsonProperty("MaxPreferredRangeEQS")]
        public long MaxPreferredRangeEqs { get; set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        [JsonProperty("NamedWeightRow")]
        public string NamedWeightRow { get; set; }

        [JsonProperty("DmgPB")]
        public long DmgPb { get; set; }

        [JsonProperty("DmgMid")]
        public double DmgMid { get; set; }

        [JsonProperty("DmgLong")]
        public double DmgLong { get; set; }

        [JsonProperty("DmgMaxRange")]
        public double DmgMaxRange { get; set; }

        [JsonProperty("EnvDmgPB")]
        public long EnvDmgPb { get; set; }

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

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

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

        [JsonProperty("ImpactDmgPB")]
        public long ImpactDmgPb { get; set; }

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

        [JsonProperty("ImpactDmgLong")]
        public double ImpactDmgLong { get; set; }

        [JsonProperty("ImpactDmgMaxRange")]
        public double ImpactDmgMaxRange { get; set; }

        [JsonProperty("bForceControl")]
        public bool BForceControl { get; set; }

        [JsonProperty("RngPB")]
        public long RngPb { get; set; }

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

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

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

        [JsonProperty("DmgScaleTable")]
        [JsonConverter(typeof(ParseStringConverter))]
        public long DmgScaleTable { get; set; }

        [JsonProperty("DmgScaleTableRow")]
        public string DmgScaleTableRow { get; set; }

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

        [JsonProperty("EnvDmgScaleTable")]
        [JsonConverter(typeof(ParseStringConverter))]
        public long EnvDmgScaleTable { get; set; }

        [JsonProperty("EnvDmgScaleTableRow")]
        public string EnvDmgScaleTableRow { get; set; }

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

        [JsonProperty("ImpactDmgScaleTable")]
        [JsonConverter(typeof(ParseStringConverter))]
        public long ImpactDmgScaleTable { get; set; }

        [JsonProperty("ImpactDmgScaleTableRow")]
        public string ImpactDmgScaleTableRow { get; set; }

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

        [JsonProperty("SurfaceRatioRowName")]
        public string SurfaceRatioRowName { get; set; }

        [JsonProperty("DamageZone_Light")]
        public long DamageZoneLight { get; set; }

        [JsonProperty("DamageZone_Normal")]
        public long DamageZoneNormal { get; set; }

        [JsonProperty("DamageZone_Critical")]
        public long DamageZoneCritical { get; set; }

        [JsonProperty("DamageZone_Vulnerability")]
        public long DamageZoneVulnerability { get; set; }

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

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

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

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

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

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

        [JsonProperty("Durability")]
        public string Durability { get; set; }

        [JsonProperty("DurabilityRowName")]
        public string DurabilityRowName { get; set; }

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

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

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

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

        [JsonProperty("ReloadTime")]
        public double ReloadTime { get; set; }

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

        [JsonProperty("ReloadType")]
        public string ReloadType { get; set; }

        [JsonProperty("bAllowReloadInterrupt")]
        public bool BAllowReloadInterrupt { get; set; }

        [JsonProperty("bReloadInterruptIsImmediate")]
        public bool BReloadInterruptIsImmediate { get; set; }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public partial class WeaponStatParser
    {
        public static WeaponStatParser FromJson(string json) => JsonConvert.DeserializeObject<WeaponStatParser>(json, FModel.Parser.Weapons.Converter.Settings);
    }

    public static class Serialize
    {
        public static string ToJson(this WeaponStatParser self) => JsonConvert.SerializeObject(self, FModel.Parser.Weapons.Converter.Settings);
    }

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

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

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

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            if (untypedValue == null)
            {
                serializer.Serialize(writer, null);
                return;
            }
            var value = (long)untypedValue;
            serializer.Serialize(writer, value.ToString());
            return;
        }

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