using ImGuiNET;
using skyscraper8.UI.MonoGame.Bridge;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace skyscraper8.UI.MonoGame.Forms
{
	internal class MessageWindow : ImGuiRenderable
	{
		public string Message { get; }
		private string WindowUuid;

		public MessageWindow(string message)
		{
			Message = message;
			WindowUuid = Guid.NewGuid().ToString();
		}

		private bool sizeSet;
		public void Update()
		{

		}

		private bool Closed;
		public void Render()
		{
			bool closeMe = true;
			if (!sizeSet)
			{
				ImGui.SetNextWindowSize(new Vector2(300, 160));
				sizeSet = true;
			}

			ImGui.Begin(String.Format("Information ##{0}", WindowUuid), ref closeMe);
			ImGui.TextWrapped(Message);
			if (ImGui.Button("OK"))
				closeMe = false;
			ImGui.End();
			if (!closeMe)
			{
				Closed = true;
				if (OnClose != null)
					OnClose();
			}
		}

		public bool WasClosed()
		{
			return Closed;
		}

		public Action OnClose { get; set; }
		public void Dispose()
		{
			
		}
	}
}
