/*
 * Copyright (C) 2012-2026 MotionSystems
 *
 * This file is part of ForceSeatMI SDK.
 *
 * www.motionsystems.eu
 *
 */

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "WheeledVehiclePawn.h"

#include "IForceSeatMI_API.h"
#include "ForceSeatMI_TelemetryACE.h"

#include "ForceSeatMIChaosVehicle_Controller.generated.h"

UCLASS( ClassGroup=(ForceSeatMIChaos), meta=(BlueprintSpawnableComponent) )
class UForceSeatMIChaosVehicle_Controller : public UActorComponent
{
	GENERATED_BODY()
public:
	UForceSeatMIChaosVehicle_Controller();
	virtual ~UForceSeatMIChaosVehicle_Controller();

public:
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	UFUNCTION(BlueprintCallable, Category = "ForceSeatMIChaosVehicle")
	void SetVehicleObject(AWheeledVehiclePawn* Input);

	UFUNCTION(BlueprintCallable, Category = "ForceSeatMIChaosVehicle")
	void SetAdditionalProperties(float SideSlip, float RoadHarshness, float G);

	UFUNCTION(BlueprintCallable, Category = "ForceSeatMIChaosVehicle")
	void SetUserAux(float aux1, float aux2, float aux3, float aux4, float aux5, float aux6, float aux7, float aux8);

	UFUNCTION(BlueprintCallable, Category = "ForceSeatMIChaosVehicle")
	void Pause(bool paused);

protected:
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;

private:
	AWheeledVehiclePawn* m_vehicle;
	IForceSeatMI_API*    m_api;
	bool                 m_firstCall;
	FSMI_TelemetryACE    m_telemetry;
	FTransform           m_prevTransform;
	float                m_prevSurgeSpeed;
	float                m_prevSwaySpeed;
	float                m_prevHeaveSpeed;
};
