using System;
using System.Collections.Generic;
using Cute;
using LitJson;
using UnityEngine;
using Wizard;
using Wizard.Lottery;

public class PracticePuzzleResultReporter : IBattleResultReporter
{
	private readonly GameObject _reportEndAgentObj;

	private readonly PracticePuzzleReportEndAgent _reportEndAgent;

	public bool IsEnd => _reportEndAgent.IsEnd;

	public int RankExp => GetRankExp();

	public int AfterRankExp => GetAfterRankExp();

	public int ClassExp => GetClassExp();

	public int WinCount => GetWinCount();

	public int RankExpBonus => GetRankExpBonus();

	public List<UserAchievement> UserAchievement => GetUserAchievementList();

	public List<UserMission> UserMission => GetUserMissionList();

	public List<ReceivedReward> MissionRewards => GetRewardsList();

	public List<ReceivedReward> VictoryRewards => null;

	public LotteryApplyData LotteryData => Data.PracticePuzzleFinishData.AchievedInfo._lotteryData;

	public MyPageHomeDialogData HomeDialogData => null;

	public bool IsDataExist => true;

	public PracticePuzzleResultReporter()
	{
		_reportEndAgentObj = new GameObject();
		_reportEndAgent = _reportEndAgentObj.AddComponent<PracticePuzzleReportEndAgent>();
	}

	public void Report(bool isWin)
	{
		StartFinishPractice(isWin, delegate
		{
			_reportEndAgent.Finished();
		});
	}

	public void StartFinishPractice(bool isWin, Action callback)
	{
		DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
		NetworkManager networkManager = Toolbox.NetworkManager;
		PracticePuzzleBattleFinish practicePuzzleBattleFinish = new PracticePuzzleBattleFinish();
		LocalLog.RecordCheckLog(LocalLog.RecordType.CERBERUS, isWin);
		practicePuzzleBattleFinish.SetParameter(dataMgr.PuzzleQuestId, (BattleManagerBase.GetIns() as PuzzleBattleManager).RetryCount, isWin);
		_reportEndAgent.StartCoroutine(networkManager.Connect(practicePuzzleBattleFinish, delegate
		{
			callback.Call();
		}, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode));
	}

	public void Destroy()
	{
		UnityEngine.Object.Destroy(_reportEndAgentObj);
	}

	public JsonData GetFinishResponseData()
	{
		return Data.PracticePuzzleFinishData._responseData;
	}

	public List<UserAchievement> GetUserAchievementList()
	{
		return Data.PracticePuzzleFinishData.achieved_achievement_list;
	}

	public List<UserMission> GetUserMissionList()
	{
		return Data.PracticePuzzleFinishData.achieved_mission_list;
	}

	public List<ReceivedReward> GetRewardsList()
	{
		return Data.PracticePuzzleFinishData.Rewards;
	}

	public int GetRankExp()
	{
		return 0;
	}

	public int GetAfterRankExp()
	{
		return 0;
	}

	public int GetClassExp()
	{
		return Data.PracticePuzzleFinishData.get_class_chara_experience;
	}

	public int GetWinCount()
	{
		return 0;
	}

	public int GetRankExpBonus()
	{
		return 0;
	}
}
