using System;
using System.Text;
using BestHTTP.Decompression.Zlib;
using LitJson;

namespace Wizard;

public class GetCardMasterTask : BaseTask
{
	public class CardMasterTaskParam : BaseParam
	{
		public string card_master_hash { get; private set; }

		public CardMasterTaskParam(string cardMasterHash)
		{
			card_master_hash = cardMasterHash;
		}
	}

	public JsonData CardMasterJsonData { get; private set; }

	public GetCardMasterTask(string cardMasterHash)
	{
		base.type = ApiType.Type.GetCardMaster;
		base.Params = new CardMasterTaskParam(cardMasterHash);
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		byte[] compressed = Convert.FromBase64String(base.ResponseData["data"]["card_master"].ToString());
		string json = Encoding.UTF8.GetString(GZipStream.UncompressBuffer(compressed));
		CardMasterJsonData = JsonMapper.ToObject(json);
		return num;
	}
}
