using System;
using System.Numerics;
using Dalamud.Bindings.ImGui;

namespace AntiDickheadChatmodule;

internal class PluginUI : IDisposable
{
	private Configuration configuration;

	private bool settingsVisible;

	private bool visible;

	public string DataPath { get; }

	public bool SettingsVisible
	{
		get
		{
			return settingsVisible;
		}
		set
		{
			settingsVisible = value;
		}
	}

	public bool Visible
	{
		get
		{
			return visible;
		}
		set
		{
			visible = value;
		}
	}

	public PluginUI(Configuration configuration, string DataPath)
	{
		this.configuration = configuration;
		this.DataPath = DataPath;
	}

	public void DrawMainWindow()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		if (Visible)
		{
			ImGui.SetNextWindowSize(new Vector2(700f, 330f), (ImGuiCond)4);
			ImGui.SetNextWindowSizeConstraints(new Vector2(700f, 330f), new Vector2(float.MaxValue, float.MaxValue));
			if (ImGui.Begin(ImU8String.op_Implicit("Dickheads be gone from mine chat"), ref visible, (ImGuiWindowFlags)24))
			{
				ImGui.Text(ImU8String.op_Implicit("Anti-fags :D"));
			}
			ImGui.End();
		}
	}

	public void Dispose()
	{
	}

	public void Draw()
	{
		DrawMainWindow();
		DrawSettingsWindow();
	}

	public void DrawSettingsWindow()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		if (!SettingsVisible)
		{
			return;
		}
		ImGui.SetNextWindowSize(new Vector2(450f, 100f), (ImGuiCond)1);
		if (ImGui.Begin(ImU8String.op_Implicit("World Map Enhancer Settings"), ref settingsVisible, (ImGuiWindowFlags)58))
		{
			bool enabled = configuration.Enabled;
			if (ImGui.Checkbox(ImU8String.op_Implicit("Enable zooming out with right click"), ref enabled))
			{
				configuration.Enabled = enabled;
				configuration.Save();
			}
			int rightClickDelay = configuration.RightClickDelay;
			if (ImGui.InputInt(ImU8String.op_Implicit("Right click release delay"), ref rightClickDelay, 25, 100, default(ImU8String), (ImGuiInputTextFlags)0))
			{
				configuration.RightClickDelay = rightClickDelay;
				configuration.Save();
			}
		}
		ImGui.End();
	}
}
