/**
 * Copyright 2022-2025 Theai, Inc. dba Inworld AI
 */

#pragma once

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"

#include "InworldRuntimeEditorSettings.generated.h"

USTRUCT()
struct FInworldDataTypeEditorInfo
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, Category = "Data")
	FColor Color{FColor::Black};
};

UENUM()
enum class EInworldGraphEditorPinsStyle : uint8
{
	Color,
	Label,
	LabelAndColor,
};

UENUM()
enum class EInworldGraphEditorPinsLabelStyle : uint8
{
	PinName,
	DataType
};

UENUM()
enum class EInworldGraphEditorNodeIdVisibility : uint8
{
	HideForAllNodes,
	ShowOnlyEndNodes,
	ShowAllNodes
};

UCLASS(Config = InworldEditor, DefaultConfig)
class INWORLDRUNTIMEEDITOR_API UInworldRuntimeEditorSettings : public UObject
{
	GENERATED_BODY()

public:
	const FInworldDataTypeEditorInfo& GetDataTypeEditorInfo(const UStruct* Struct) const;

	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor|Pins")
	EInworldGraphEditorPinsStyle PinsStyle{EInworldGraphEditorPinsStyle::LabelAndColor};

	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor|Pins")
	EInworldGraphEditorPinsLabelStyle PinsLabelStyle;

	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor|Pins|Color")
	uint8 PinDefaultColorSaturation{220};

	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor|Pins|Color")
	uint8 PinDefaultColorValue{20};

	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor",
		meta = (DisplayName = "Use friendly names for DataTypes labels/descriptions"))
	bool bUseFriendlyNamesForDataTypes{true};

	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor",
		meta = (DisplayName = "Disallow connection if DataTypes are incompatible"))
	bool bStrictDataTypesCompatibleCheck{true};

	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor",
		meta = (DisplayName = "Enable compatible nodes filter for context menu"))
	bool bEnableCompatibleNodesFilter{true};

	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor", meta = (DisplayName = "Node Id visibility"))
	EInworldGraphEditorNodeIdVisibility NativeNodeIdVisibility{EInworldGraphEditorNodeIdVisibility::ShowOnlyEndNodes};

	UPROPERTY(
		config, EditAnywhere, Category = "Inworld|GraphEditor|Advanced", meta = (DisplayName = "Allow assets from the test plugin"))
	bool bAllowTestPluginAssets{false};

private:
	UPROPERTY(config, EditAnywhere, Category = "Inworld|GraphEditor", meta = (ShowOnlyInnerProperties))
	mutable TMap<FString, FInworldDataTypeEditorInfo> DataTypeEditorInfo;
};
