#pragma once

#include "CoreMinimal.h"
#include "Interactable.h"
#include "UObject/NoExportTypes.h"
#include "K40SecurityDoor.generated.h"

class UK40SecurityDoorTargetableComponent;
class AK40SecurityDoor;
class AK40SecurityCamera;
class UK40SecurityDoorEnterInteraction;
class UK40SecurityCorridorInteraction;
class UK40SecurityDoorExitInteraction;
class UK40SecuritySystemAbility;
class ASurvivor;
class AKiller;

UCLASS(Blueprintable)
class AK40SecurityDoor : public AInteractable
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	bool _isInUse;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FLinearColor _revealedToKillerColorWhileASurvivorIsTravellingThrough;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Export)
	TWeakObjectPtr<UK40SecurityDoorTargetableComponent> _survivorSecurityDoorTargetableComponent;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_ConnectedDoor, meta=(AllowPrivateAccess=true))
	TWeakObjectPtr<AK40SecurityDoor> _connectedDoor;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	AK40SecurityCamera* _securityCamera;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UK40SecurityDoorEnterInteraction* _enterInteraction;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UK40SecurityCorridorInteraction* _corridorInteraction;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UK40SecurityDoorExitInteraction* _exitInteraction;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UK40SecuritySystemAbility* _owningAbility;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_DoorNumberID, meta=(AllowPrivateAccess=true))
	int32 _doorNumberID;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	float _targetSpringArmLength;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FName _anchorRelativeLocationSceneComponentTag;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FName _targetCameraLocationSceneComponentTag;

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_DoorNumberID();

	UFUNCTION()
	void OnRep_ConnectedDoor(TWeakObjectPtr<AK40SecurityDoor> oldConnectedDoor);

public:
	UFUNCTION(BlueprintPure)
	bool IsPoweredDown() const;

	UFUNCTION(BlueprintPure)
	bool IsInUse() const;

	UFUNCTION(BlueprintCallable)
	AK40SecurityCamera* GetSecurityCamera();

	UFUNCTION(BlueprintPure)
	int32 GetDoorNumberID() const;

	UFUNCTION(BlueprintPure)
	ASurvivor* GetCurrentlyInteractingSurvivor() const;

	UFUNCTION(BlueprintPure)
	AKiller* GetCurrentlyInteractingKiller() const;

	UFUNCTION(BlueprintPure)
	AK40SecurityDoor* GetConnectedDoor() const;

	UFUNCTION(BlueprintCallable)
	float GetBatteryPower();

protected:
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_SetNumberVisibility(bool isKillerTargeting);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorUsingCameraPanelStop(ASurvivor* survivor);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorUsingCameraPanelStart(ASurvivor* survivor);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorExitingStop(ASurvivor* survivor);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorExitingStart(ASurvivor* survivor);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorEnteringStop(ASurvivor* survivor);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorEnteringStart(ASurvivor* survivor);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnKillerExitingStop(AKiller* killer);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnKillerExitingStart(AKiller* killer);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnKillerEnteringStop(AKiller* killer);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnKillerEnteringStart(AKiller* killer);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnIsInUseChanged(bool isInUse);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnDoorNumberIDChanged();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnDisabledStop();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnDisabledStart();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnConnectedDoorChanged(int32 connectedDoorId);

public:
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnBatteryPowerPercentageChanged(float batteryPowerPercentage);

public:
	virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;

public:
	AK40SecurityDoor();
};

FORCEINLINE uint32 GetTypeHash(const AK40SecurityDoor) { return 0; }
