// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Engine/DeveloperSettings.h"
#include "Engine/StaticMeshActor.h"
#include "Faye/Data/OrderSettingsDataAsset.h"
#include "Faye/Inventory/CoffeeItem.h"
#include "FayeDeveloperSettings.generated.h"

class USUDSScript;
class UShopListDataAsset;
enum class EBookCategory : uint8;

USTRUCT(BlueprintType)
struct FBookShelfVariation
{
	GENERATED_BODY()
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "BookShelf")
	TArray<TSoftObjectPtr<UStaticMesh>> StaticMeshVariations;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "BookShelf")
	float BookWidth = 0.f;
	
};

UENUM(BlueprintType, meta = (BitFlags))
enum class EBookFilterFlags : uint8
{
	Author,
	PublicationYear,
	BookCategory,
	BookSubcategory,
	PageNumber
};
ENUM_CLASS_FLAGS(EBookFilterFlags)

USTRUCT(BlueprintType)
struct FBookFilterFlagsSet
{
	GENERATED_BODY()
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Flags", meta = (Bitmask, BitmaskEnum = "/Script/Faye.EBookFilterFlags"))
	int32 Flags = 0;
};

UENUM(BlueprintType)
enum class EPageNumberCategorisation : uint8
{
	Short,
	Medium,
	Long
};

/**
 * 
 */
UCLASS(Config = Game, defaultconfig, meta = (DisplayName = "Faye Settings"))
class FAYE_API UFayeDeveloperSettings : public UDeveloperSettings
{
	GENERATED_BODY()
	
public:
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Books")
	TMap<EBookCategory, FLinearColor> BookCategoryColorMap;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Items")
	TSoftObjectPtr<UDataTable> BooksDataTable;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Items")
	TSoftObjectPtr<UShopListDataAsset> ShopListDataAsset;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Coffee")
	TSoftObjectPtr<UOrderSettingsDataAsset> GenericCoffeeOrderSettingsAsset;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Coffee")
	FCoffeeItemTranslations CoffeeTranslations;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Shelves")
	TMap<int32, FBookShelfVariation> BookShelfVariations;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Shelves")
	TSoftObjectPtr<UMaterialInterface> TransparentBookMaterial;
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Shelves")
	TSoftObjectPtr<UMaterialInterface> TransparentBookMaterial_Highlighted;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Shelves")
	TSubclassOf<AStaticMeshActor> DefaultBookStaticMeshClass;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Faye Settings")
	TArray<FBookFilterFlagsSet> BookFilterVariations;
	
	UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Faye Settings")
	TMap<EPageNumberCategorisation, int32> BookLengthLimits;
	
	UFUNCTION(BlueprintPure, Category = "Faye Settings")
	static const TMap<EBookCategory, FLinearColor>& GetBookCategoryColorMap();

	const UOrderSettingsDataAsset* GetOrderSettingDataAsset() const { return GenericCoffeeOrderSettingsAsset.LoadSynchronous(); }
};
