//
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "12.12.1.0")]
public partial class FindClansResultFactory : global::StrawberryShake.IOperationResultDataFactory
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
public FindClansResultFactory(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.IFindClansResult);
public FindClansResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
{
if (snapshot is null)
{
snapshot = _entityStore.CurrentSnapshot;
}
if (dataInfo is FindClansResultInfo info)
{
return new FindClansResult(MapIFindClans_ClansNonNullableArray(info.Clans, snapshot));
}
throw new global::System.ArgumentException("FindClansResultInfo expected.");
}
private global::System.Collections.Generic.IReadOnlyList? MapIFindClans_ClansNonNullableArray(global::System.Collections.Generic.IReadOnlyList? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
if (list is null)
{
return null;
}
var clanSearchResponseItems = new global::System.Collections.Generic.List();
foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData child in list)
{
clanSearchResponseItems.Add(MapNonNullableIFindClans_Clans(child, snapshot));
}
return clanSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans MapNonNullableIFindClans_Clans(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
IFindClans_Clans returnValue = default !;
if (data.__typename.Equals("ClanSearchResponseItem", global::System.StringComparison.Ordinal))
{
returnValue = new FindClans_Clans_ClanSearchResponseItem(data.ClanId ?? throw new global::System.ArgumentNullException(), data.CreatedAt ?? throw new global::System.ArgumentNullException(), data.MembersCount ?? throw new global::System.ArgumentNullException(), data.Name, data.Tag);
}
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);
}
}
}