//
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "12.12.1.0")]
public partial class DictionaryResultFactory : global::StrawberryShake.IOperationResultDataFactory
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
public DictionaryResultFactory(global::StrawberryShake.IEntityStore entityStore)
{
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
}
global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryResult);
public DictionaryResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
{
if (snapshot is null)
{
snapshot = _entityStore.CurrentSnapshot;
}
if (dataInfo is DictionaryResultInfo info)
{
return new DictionaryResult(MapNonNullableIDictionary_VehiclesNonNullableArray(info.Vehicles, snapshot));
}
throw new global::System.ArgumentException("DictionaryResultInfo expected.");
}
private global::System.Collections.Generic.IReadOnlyList MapNonNullableIDictionary_VehiclesNonNullableArray(global::System.Collections.Generic.IReadOnlyList? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
if (list is null)
{
throw new global::System.ArgumentNullException();
}
var vehicleResponses = new global::System.Collections.Generic.List();
foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.VehicleResponseData child in list)
{
vehicleResponses.Add(MapNonNullableIDictionary_Vehicles(child, snapshot));
}
return vehicleResponses;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionary_Vehicles MapNonNullableIDictionary_Vehicles(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.VehicleResponseData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
IDictionary_Vehicles returnValue = default !;
if (data.__typename.Equals("VehicleResponse", global::System.StringComparison.Ordinal))
{
returnValue = new Dictionary_Vehicles_VehicleResponse(data.TankId ?? throw new global::System.ArgumentNullException(), data.Name ?? throw new global::System.ArgumentNullException(), data.Description ?? throw new global::System.ArgumentNullException(), data.IsPremium ?? throw new global::System.ArgumentNullException(), data.TypeId ?? throw new global::System.ArgumentNullException(), data.NationId ?? throw new global::System.ArgumentNullException(), data.Tier ?? throw new global::System.ArgumentNullException(), data.PreviewImage ?? throw new global::System.ArgumentNullException(), data.NormalImage ?? throw new global::System.ArgumentNullException(), data.PriceCredit ?? throw new global::System.ArgumentNullException(), data.PriceGold ?? throw new global::System.ArgumentNullException(), data.NexTanksInTree);
}
else
{
throw new global::System.NotSupportedException();
}
return returnValue;
}
global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot)
{
return Create(dataInfo, snapshot);
}
}
}