using System.Collections.Generic;
using System.Linq;
using LitJson;

namespace Wizard;

public class PracticePuzzleData
{
	public int GroupdId { get; private set; }

	public string Title { get; private set; }

	public int CurrentClearCount { get; private set; }

	public int MaxClearCount { get; private set; }

	public bool IsMissionTarget { get; private set; }

	public bool IsClear => CurrentClearCount >= MaxClearCount;

	public PracticePuzzleData(JsonData json)
	{
		GroupdId = json["puzzle_master_id"].ToInt();
		IsMissionTarget = json["is_mission_target"].ToBoolean();
		Title = Data.SystemText.Get(json["basic_title_text_id"].ToString());
		List<PuzzleQuestSelectDialog.DisplayData> list = PuzzleQuestSelectDialog.CreateDisplayData(isDisplayNew: true, json["puzzle_data"]);
		MaxClearCount = list.Count;
		CurrentClearCount = list.Count((PuzzleQuestSelectDialog.DisplayData puzzle) => puzzle.IsCleared);
	}
}
