// Copyright (c) Microsoft Corporation. 
// Licensed under the MIT license.

#pragma once

#include "ITreeItem.h"
#include "TreeItemID.h"

class AStandInMeshActor;
class AActor;

namespace StandInsOutliner
{
	/** Helper class to manage moving arbitrary data onto an actor */
	struct FStandInMeshActorDropTarget : IDropTarget
	{
		/** The actor this tree item is associated with. */
		TWeakObjectPtr<AStandInMeshActor> StandInMeshActor;

		/** Construct this object out of an Actor */
		FStandInMeshActorDropTarget(AStandInMeshActor* InStandInMeshActor) : StandInMeshActor(InStandInMeshActor) {}

	public:
		/** Called to test whether the specified payload can be dropped onto this tree item */
		virtual FDragValidationInfo ValidateDrop(FDragDropPayload& DraggedObjects) const override;

		/** Called to drop the specified objects on this item. Only called if ValidateDrop() allows. */
		virtual void OnDrop(FDragDropPayload& DraggedObjects, const FDragValidationInfo& ValidationInfo, TSharedRef<SWidget> DroppedOnWidget) override;

	};

	struct FStandInMeshActorItem : ITreeItem
	{
		mutable TWeakObjectPtr<AStandInMeshActor> StandInMeshActor;
		mutable FTreeItemID ID;

		FStandInMeshActorItem(AStandInMeshActor* InStandInMeshActor);

		//~ Begin ITreeItem Interface.
		virtual bool CanInteract() const override;
		virtual void GenerateContextMenu(FMenuBuilder& MenuBuilder, SStandInsOutliner& Outliner) override;
		virtual FString GetDisplayString() const override;
		virtual FString GetName() const override;
		virtual FSlateColor GetTint() const override;
		virtual FTreeItemID GetID() override;
		//~ End ITreeItem Interface.

		/** Returns the level the meshes are in Ftext form */
		FText GetLevelAsText() const;

		/** Returns the number of sub actors in FText form */
		FText GetNumberOfSubActorsAsText() const;

		FText GetNumTrianglesAsText() const;

		/** Returns the number of sub actors in FText form */
		FText GetStandInProcessTypeAsText() const;

		/** Returns the number of sub actors in FText form */
		FText GetLODGroupdAsText() const;

		/** Populate the specified drag/drop payload with any relevant information for this type */
		virtual void PopulateDragDropPayload(FDragDropPayload& Payload) const override;

		/** Called to test whether the specified payload can be dropped onto this tree item */
		virtual FDragValidationInfo ValidateDrop(FDragDropPayload& DraggedObjects) const override;

		/** Called to drop the specified objects on this item. Only called if ValidateDrop() allows. */
		virtual void OnDrop(FDragDropPayload& DraggedObjects, const FDragValidationInfo& ValidationInfo, TSharedRef<SWidget> DroppedOnWidget) override;

		void GenerateSourceActorsContextMenu(FMenuBuilder& MenuBuilder);

		//ECheckBoxState IsEditorStandin() const;
		//void OnEditorStandinChanged(ECheckBoxState InState);
		
		ECheckBoxState IsGameStandin() const;
		void OnGameStandinChanged(ECheckBoxState InState);

		
		void SetIsVisibleInEditor(bool bIsVisible);

		virtual bool IsHiddenInEditor() const override;
		void SetHiddenInEditor(bool bHidden);
	};
};
