using System.Collections.Generic;

namespace Wizard;

public class GatheringEntryTask : BaseTask
{
	public class DeckEntry
	{
		public int deck_no;

		public string deck_name;

		public DeckEntry(DeckData deck)
		{
			deck_no = deck.GetDeckID();
			deck_name = deck.GetDeckName();
		}
	}

	public class GatheringEntryTaskParam : BaseParam
	{
		public string gathering_id;

		public Dictionary<string, DeckEntry> deck_list = new Dictionary<string, DeckEntry>();
	}

	public GatheringEntryTask()
	{
		base.type = ApiType.Type.GatheringEntry;
	}

	public void SetParameter(string id, List<DeckData> deckList)
	{
		GatheringEntryTaskParam gatheringEntryTaskParam = new GatheringEntryTaskParam();
		gatheringEntryTaskParam.gathering_id = id;
		if (deckList != null)
		{
			for (int i = 0; i < deckList.Count; i++)
			{
				gatheringEntryTaskParam.deck_list[i.ToString()] = new DeckEntry(deckList[i]);
			}
		}
		else
		{
			gatheringEntryTaskParam.deck_list = null;
		}
		base.Params = gatheringEntryTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		Data.MyPageNotifications.data.IsInviteGathering = false;
		return num;
	}
}
