#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "ImpactInfo.h"
#include "Engine/NetSerialization.h"
#include "UObject/NoExportTypes.h"
#include "LaunchInfo.h"
#include "BaseProjectileReplicationComponent.generated.h"

class ABaseProjectile;

UCLASS(Blueprintable, EditInlineNew, meta=(BlueprintSpawnableComponent))
class PROJECTILE_API UBaseProjectileReplicationComponent : public UActorComponent
{
	GENERATED_BODY()

private:
	UFUNCTION(BlueprintCallable, Server, Reliable)
	void Server_TryDetectPlayer(ABaseProjectile* projectile, FImpactInfo impactInfo, const FVector_NetQuantize100 projectileLocation, const FVector_NetQuantize10 projectileRotation, const float targetLocationTimestamp, const float launchTime, const float clientTime, const FVector projectileCurrentLocationOnClient);

	UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
	void Mutlicast_DetectSlashable(ABaseProjectile* projectile, FImpactInfo impactInfo);

	UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
	void Multicast_SendAuthorityDetectPlayer(ABaseProjectile* projectile, FImpactInfo impactInfo);

	UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
	void Multicast_OnLaunchWithImpact(ABaseProjectile* projectile, FLaunchInfo launchInfo, FImpactInfo impactInfo, const bool wasPredicted);

	UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
	void Multicast_OnLaunch(ABaseProjectile* projectile, FLaunchInfo launchInfo, const bool wasPredicted);

	UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
	void Multicast_DetectPlayer(ABaseProjectile* projectile, FImpactInfo impactInfo);

	UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
	void Multicast_DetectImpact(ABaseProjectile* projectile, FImpactInfo impactInfo);

	UFUNCTION(BlueprintCallable, Client, Reliable)
	void Client_ReceiveDetectPlayerValidation(ABaseProjectile* projectile, bool success);

public:
	UFUNCTION(BlueprintCallable, Client, Reliable)
	void Client_LaunchRefusedByServer(ABaseProjectile* projectile);

public:
	UBaseProjectileReplicationComponent();
};

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