using LitJson;

namespace Wizard.Scripts.Network.Task.Arena.TwoPick;

public class CardChooseTask : BaseTask
{
	public class ArenaTwoPickCardChooseTaskParam : BaseParam
	{
		public int selected_id;
	}

	public CardChooseTask()
	{
		base.type = ApiType.Type.ArenaTwoPickCardChoose;
	}

	public void SetParameter(int selected_id)
	{
		ArenaTwoPickCardChooseTaskParam arenaTwoPickCardChooseTaskParam = new ArenaTwoPickCardChooseTaskParam();
		arenaTwoPickCardChooseTaskParam.selected_id = selected_id;
		base.Params = arenaTwoPickCardChooseTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		JsonData jsonData = base.ResponseData["data"];
		Wizard.Data.TwoPickInfo.SetDeckInfo(jsonData["deck_info"]);
		if (!Wizard.Data.TwoPickInfo.deckInfo.isSelectCompleted)
		{
			Wizard.Data.TwoPickInfo.SetCandidateCardList(jsonData["candidate_card_list"]);
		}
		return num;
	}
}
