#pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "ZMMOPlayerController.generated.h"

class UInputMappingContext;
class UUserWidget;

/**
 *  AZMMOPlayerController
 *
 *  Player controller do cliente Zeus MMO. Responsavel apenas pela camada de
 *  input do Unreal (Enhanced Input Mapping Contexts e widget opcional de
 *  controlos touch). Toda a logica de identidade Zeus, envio de input e
 *  reconciliacao vive em `AZMMOPlayerCharacter`.
 */
UCLASS(Blueprintable, BlueprintType)
class ZMMO_API AZMMOPlayerController : public APlayerController
{
	GENERATED_BODY()

public:
	AZMMOPlayerController();

protected:
	/** Mapping contexts default (sempre adicionados). */
	UPROPERTY(EditAnywhere, Category = "Input|Input Mappings")
	TArray<UInputMappingContext*> DefaultMappingContexts;

	/** Mapping contexts saltados quando estamos em modo touch. */
	UPROPERTY(EditAnywhere, Category = "Input|Input Mappings")
	TArray<UInputMappingContext*> MobileExcludedMappingContexts;

	/** Widget opcional de controlos touch (mobile / forced). */
	UPROPERTY(EditAnywhere, Category = "Input|Touch Controls")
	TSubclassOf<UUserWidget> MobileControlsWidgetClass;

	UPROPERTY()
	TObjectPtr<UUserWidget> MobileControlsWidget;

	/** Forca controlos touch mesmo fora de plataformas mobile (uso em desktop dev). */
	UPROPERTY(EditAnywhere, Config, Category = "Input|Touch Controls")
	bool bForceTouchControls = false;

	virtual void BeginPlay() override;
	virtual void SetupInputComponent() override;

	bool ShouldUseTouchControls() const;

	/** Hotkey Alt+A → toggle StatusWindow via UUIInGameFlowSubsystem. */
	void ToggleStatusWindow();

	/** Hotkey J → toggle JobChangePanel (Jobs.1 — promocao de classe). */
	void ToggleJobChangePanel();
};
