using LitJson;
using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick;
using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick;

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

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

	public CandidateCardInfo CandidateCardInfo;

	public Deck DeckInfo;

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

	public void SetParameter(int selected_id)
	{
		CompetitionCardChooseTaskParam competitionCardChooseTaskParam = new CompetitionCardChooseTaskParam();
		competitionCardChooseTaskParam.selected_id = selected_id;
		base.Params = competitionCardChooseTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		JsonData jsonData = base.ResponseData["data"];
		DeckInfo = new Deck(jsonData["deck_info"]);
		if (!DeckInfo.isSelectCompleted)
		{
			CandidateCardInfo = new CandidateCardInfo(jsonData["candidate_card_list"]);
		}
		return num;
	}
}
