using System.Collections.Generic;
using LitJson;

namespace Wizard;

public class ReplayInfoTask : BaseTask
{
	public class ReplayInfoTaskParam : BaseParam
	{
	}

	public ReplayInfoTask()
	{
		base.type = ApiType.Type.ReplayInfo;
	}

	public void SetParameter()
	{
		ReplayInfoTaskParam replayInfoTaskParam = new ReplayInfoTaskParam();
		base.Params = replayInfoTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		List<ReplayInfoItem> list = new List<ReplayInfoItem>();
		JsonData jsonData = base.ResponseData["data"]["replay_list"];
		for (int i = 0; i < jsonData.Count; i++)
		{
			list.Add(new ReplayInfoItem(jsonData[i]));
		}
		Data.ReplayInfo.Items = list;
		if (base.ResponseData["data"].Keys.Contains("feature_maintenance_list"))
		{
			List<NetworkDefine.MAINTENANCE_TYPE> list2 = new List<NetworkDefine.MAINTENANCE_TYPE>();
			for (int j = 0; j < base.ResponseData["data"]["feature_maintenance_list"].Count; j++)
			{
				list2.Add((NetworkDefine.MAINTENANCE_TYPE)base.ResponseData["data"]["feature_maintenance_list"][j].ToInt());
			}
			Data.UpdateMaintenance(new List<NetworkDefine.MAINTENANCE_TYPE>
			{
				NetworkDefine.MAINTENANCE_TYPE.REPLAY_ALL,
				NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_ALL,
				NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_EXCLUDE_ROTATION,
				NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_RECORD
			}, list2);
		}
		return num;
	}
}
