using System.Collections.Generic;
using LitJson;

namespace Wizard;

public class GetSelectSkinOwnedStatusTask : BaseTask
{
	public class SelectSkinCardListTaskParam : BaseParam
	{
		public int parent_gacha_id;
	}

	public Dictionary<CardBasePrm.ClanType, List<SelectSkinCardInfo>> SkinCardListInClassDic { get; private set; }

	public GetSelectSkinOwnedStatusTask()
	{
		base.type = ApiType.Type.GetSelectSkinOwnedStatus;
	}

	public void SetParameter(int packId)
	{
		SelectSkinCardListTaskParam selectSkinCardListTaskParam = new SelectSkinCardListTaskParam();
		selectSkinCardListTaskParam.parent_gacha_id = packId;
		base.Params = selectSkinCardListTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		JsonData jsonData = base.ResponseData["data"];
		SkinCardListInClassDic = new Dictionary<CardBasePrm.ClanType, List<SelectSkinCardInfo>>();
		for (CardBasePrm.ClanType clanType = CardBasePrm.ClanType.MIN; clanType < CardBasePrm.ClanType.MAX; clanType++)
		{
			SkinCardListInClassDic[clanType] = new List<SelectSkinCardInfo>();
			int num2 = (int)clanType;
			JsonData jsonData2 = jsonData[num2.ToString()];
			if (jsonData2.Count != 0)
			{
				List<string> list = new List<string>(jsonData2.Keys);
				for (int i = 0; i < list.Count; i++)
				{
					string prop_name = list[i];
					SelectSkinCardInfo item = new SelectSkinCardInfo(jsonData2[prop_name], clanType);
					SkinCardListInClassDic[clanType].Add(item);
				}
			}
		}
		return num;
	}
}
