using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Xml;

namespace TeslaConsole.BattleTech;

public class BTMap
{
	private readonly string mKey;

	private readonly string mName;

	private readonly string mImagePath;

	public string Key => mKey;

	public string Name => mName;

	public Image Image
	{
		get
		{
			if (mImagePath == null)
			{
				return null;
			}
			return ImageCache.GetImage(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), mImagePath));
		}
	}

	internal BTMap(XmlNode mapNode)
	{
		XmlAttribute xmlAttribute = mapNode.Attributes["image"];
		mKey = mapNode.Attributes["key"].InnerText;
		mName = mapNode.Attributes["name"].InnerText;
		mImagePath = xmlAttribute?.InnerText;
	}

	public override string ToString()
	{
		return mName;
	}
}
