#pragma once

#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "DruidsMCPBridgeEditorSettings.generated.h"

UCLASS()
class UDruidsMCPBridgeEditorSettings : public UObject
{
	GENERATED_BODY()

public:
	UDruidsMCPBridgeEditorSettings();

	void RefreshFromEndpoint(const FString& InEndpointUrl, bool bInServerRunning);

	UPROPERTY(VisibleAnywhere, Category = "Server")
	FString ServerStatus;

	UPROPERTY(VisibleAnywhere, Category = "Server")
	FString ServerEndpoint;

	UPROPERTY(VisibleAnywhere, Category = "Codex", meta = (MultiLine = true))
	FString CodexConfigSnippet;

	UPROPERTY(VisibleAnywhere, Category = "Codex")
	FString CodexInstallCommand;

	UPROPERTY(VisibleAnywhere, Category = "Claude Code")
	FString ClaudeCodeInstallCommand;

	UPROPERTY(VisibleAnywhere, Category = "Gemini CLI")
	FString GeminiInstallCommand;

	UPROPERTY(VisibleAnywhere, Category = "Gemini CLI", meta = (MultiLine = true))
	FString GeminiMcpJson;

	UPROPERTY(VisibleAnywhere, Category = "Google Antigravity", meta = (MultiLine = true))
	FString AntigravityMcpJson;

	UPROPERTY(VisibleAnywhere, Category = "Cursor", meta = (MultiLine = true))
	FString CursorMcpJson;

	UPROPERTY(VisibleAnywhere, Category = "JetBrains / Rider", meta = (MultiLine = true))
	FString JetBrainsMcpJson;

	UPROPERTY(VisibleAnywhere, Category = "Notes", meta = (MultiLine = true))
	FString SetupNotes;

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void RefreshSetupSnippets();

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void CopyCodexConfigSnippet() const;

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void CopyCodexInstallCommand() const;

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void CopyClaudeCodeInstallCommand() const;

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void CopyGeminiInstallCommand() const;

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void CopyGeminiMcpJson() const;

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void CopyAntigravityMcpJson() const;

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void CopyCursorMcpJson() const;

	UFUNCTION(CallInEditor, Category = "AI Setup")
	void CopyJetBrainsMcpJson() const;

private:
	static FString GetDefaultEndpointUrl();
	static void CopyTextToClipboard(const FString& Text);
};
