using System;
using LitJson;

namespace Wizard;

public class SpeedChallengeInfo
{
	public DateTime Begin { get; private set; }

	public DateTime ApplyEnd { get; private set; }

	public DateTime Announce { get; private set; }

	public DateTime End { get; private set; }

	public string Message { get; private set; }

	public string ApplyUrl { get; private set; }

	public SpeedChallengeInfo(JsonData data)
	{
		Parse(data);
	}

	private void Parse(JsonData data)
	{
		if (data.TryGetValue("schedule", out var value))
		{
			Begin = DateTime.Parse(value["begin_time"].ToString());
			ApplyEnd = DateTime.Parse(value["apply_end_time"].ToString());
			Announce = DateTime.Parse(value["announce_time"].ToString());
			End = DateTime.Parse(value["end_time"].ToString());
		}
		if (data.TryGetValue("dialog_message", out var value2))
		{
			Message = value2.ToString().Replace("\\n", "\n");
		}
		if (data.TryGetValue("apply_url", out var value3))
		{
			ApplyUrl = value3.ToString();
		}
	}
}
