using System.Collections.Generic;
using LitJson;

namespace Wizard.Scripts.Network.Data.TaskData.SpotCardExchange;

public class GachaPointExchangeInfoTask : BaseTask
{
	public class GachaPointExchangeInfoTaskParam : BaseParam
	{
		public int odds_gacha_id;

		public int parent_gacha_id;
	}

	public Dictionary<CardBasePrm.ClanType, List<GachaPointExchangeInfo>> ExchangeableRewardListInClassDict { get; private set; }

	public GachaPointExchangeInfoTask()
	{
		base.type = ApiType.Type.GachaPointInfo;
	}

	public void SetParameter(int oddsGachaId, int gachaPointPackId)
	{
		GachaPointExchangeInfoTaskParam gachaPointExchangeInfoTaskParam = new GachaPointExchangeInfoTaskParam();
		gachaPointExchangeInfoTaskParam.odds_gacha_id = oddsGachaId;
		gachaPointExchangeInfoTaskParam.parent_gacha_id = gachaPointPackId;
		base.Params = gachaPointExchangeInfoTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		JsonData jsonData = base.ResponseData["data"];
		ExchangeableRewardListInClassDict = new Dictionary<CardBasePrm.ClanType, List<GachaPointExchangeInfo>>();
		for (CardBasePrm.ClanType clanType = CardBasePrm.ClanType.ALL; clanType < CardBasePrm.ClanType.MAX; clanType++)
		{
			ExchangeableRewardListInClassDict[clanType] = new List<GachaPointExchangeInfo>();
		}
		JsonData jsonData2 = jsonData["gacha_point_rewards"];
		for (int i = 0; i < jsonData2.Count; i++)
		{
			GachaPointExchangeInfo gachaPointExchangeInfo = new GachaPointExchangeInfo(jsonData2[i]);
			ExchangeableRewardListInClassDict[gachaPointExchangeInfo.Class].Add(gachaPointExchangeInfo);
		}
		return num;
	}
}
