namespace Wizard;

public class ChatGetMessagesTask : BaseTask
{
	public class ChatGetMessagesTaskParam : BaseParam
	{
		public int start_message_id { get; set; }

		public int direction { get; set; }

		public int wait_interval { get; set; }
	}

	private const int LATEST_REQUEST_MESSAGE_ID = 0;

	private const Chat.eRequestDirection LATEST_REQUEST_DIRECTION = Chat.eRequestDirection.OLD;

	public ChatInfo ChatInfo { get; private set; }

	public ChatGetMessagesTask(ApiType.Type apiType)
	{
		base.type = apiType;
	}

	public void SetParameter(int startMessageId, Chat.eRequestDirection direction, int waitInterval)
	{
		ChatGetMessagesTaskParam chatGetMessagesTaskParam = new ChatGetMessagesTaskParam();
		chatGetMessagesTaskParam.start_message_id = startMessageId;
		chatGetMessagesTaskParam.direction = (int)direction;
		chatGetMessagesTaskParam.wait_interval = waitInterval;
		base.Params = chatGetMessagesTaskParam;
	}

	public void SetParameterLatestLog(int waitInterval)
	{
		ChatGetMessagesTaskParam chatGetMessagesTaskParam = new ChatGetMessagesTaskParam();
		chatGetMessagesTaskParam.start_message_id = 0;
		chatGetMessagesTaskParam.direction = 1;
		chatGetMessagesTaskParam.wait_interval = waitInterval;
		base.Params = chatGetMessagesTaskParam;
	}

	protected override int Parse()
	{
		int num = base.Parse();
		if (num != 1)
		{
			return num;
		}
		GameMgr.GetIns().GetDataMgr().SetMaintenanceCardIds(base.ResponseData["data"]["maintenance_card_list"]);
		ChatInfo = new ChatInfo(base.ResponseData["data"]);
		return num;
	}
}
