using System.Collections.Generic;
using LitJson;

namespace Wizard;

public class ChatDeckLogTask : BaseTask
{
	public List<ChatMessageInfo.DeckLogData> DeckLogListRotation { get; private set; }

	public List<ChatMessageInfo.DeckLogData> DeckLogListUnlimited { get; private set; }

	public List<ChatMessageInfo.DeckLogData> DeckLogListPreRotation { get; private set; }

	public List<ChatMessageInfo.DeckLogData> DeckLogListCrossover { get; private set; }

	public List<ChatMessageInfo.DeckLogData> DeckLogListMyRotation { get; private set; }

	public ChatDeckLogTask(ApiType.Type apiType)
	{
		base.type = apiType;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		JsonData jsonData = base.ResponseData["data"]["deck_log"];
		GameMgr.GetIns().GetDataMgr().SetMaintenanceCardIds(base.ResponseData["data"]["maintenance_card_list"]);
		DeckLogListRotation = ChatMessageInfo.DeckLogData.ParseDeckDataList(jsonData[Data.FormatConvertApi(Format.Rotation).ToString()]);
		DeckLogListUnlimited = ChatMessageInfo.DeckLogData.ParseDeckDataList(jsonData[Data.FormatConvertApi(Format.Unlimited).ToString()]);
		DeckLogListPreRotation = ChatMessageInfo.DeckLogData.ParseDeckDataList(jsonData[Data.FormatConvertApi(Format.PreRotation).ToString()]);
		if (jsonData.TryGetValue(Data.FormatConvertApi(Format.Crossover).ToString(), out var value))
		{
			DeckLogListCrossover = ChatMessageInfo.DeckLogData.ParseDeckDataList(value);
		}
		if (jsonData.TryGetValue(Data.FormatConvertApi(Format.MyRotation).ToString(), out var value2))
		{
			DeckLogListMyRotation = ChatMessageInfo.DeckLogData.ParseDeckDataList(value2);
		}
		return num;
	}
}
