using System.Collections.Generic;
using LitJson;

namespace Wizard;

public class BossRushClearDeckListTask : BaseTask
{
	public List<DeckData> DeckList { get; private set; } = new List<DeckData>();

	public Dictionary<int, List<BossRushLobbyAbilityData>> AbilityDictionary { get; private set; } = new Dictionary<int, List<BossRushLobbyAbilityData>>();

	public BossRushClearDeckListTask()
	{
		base.type = ApiType.Type.BossRushClearDeckList;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		JsonData jsonData = base.ResponseData["data"];
		for (int i = 0; i < jsonData.Count; i++)
		{
			JsonData jsonData2 = jsonData[i];
			DeckData deckData = new DeckData(Data.ParseApiFormat(jsonData2["deck_format"].ToInt()));
			deckData.Initialize(jsonData2);
			deckData.SetDeckID(jsonData2["challenge_count_num"].ToInt());
			DeckList.Add(deckData);
			JsonData jsonData3 = jsonData2["special_ability_list"];
			List<BossRushLobbyAbilityData> list = new List<BossRushLobbyAbilityData>();
			for (int j = 0; j < jsonData3.Count; j++)
			{
				list.Add(new BossRushLobbyAbilityData(jsonData3[j]));
			}
			AbilityDictionary.Add(deckData.GetDeckID(), list);
		}
		return num;
	}
}
