// © 2025 Naked People Team. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "PhoneItemDefinition.h"
#include "NakedDesire/Items/ItemInstance.h"
#include "PhoneItemInstance.generated.h"

/** Per-instance mutable state for a phone. Battery is per-phone-instance (§9.9). */
USTRUCT()
struct FPhoneInstanceState : public FItemInstanceState
{
	GENERATED_BODY()

	UPROPERTY(SaveGame)
	float CurrentBattery = 100.0f;
};

UCLASS(BlueprintType)
class NAKEDDESIRE_API UPhoneItemInstance : public UItemInstance
{
	GENERATED_BODY()

public:
	// Charge of this specific phone, [0,1]. Drain / charge logic lands with the phone battery system (Phase 8/9).
	UPROPERTY(BlueprintReadOnly, Category = "Phone Item")
	float CurrentBattery = 100.0f;

	UPhoneItemDefinition* GetPhoneItemDefinition() const { return Cast<UPhoneItemDefinition>(ItemDefinition); }

protected:
	virtual void CaptureState(FInstancedStruct& OutState) const override;
	virtual void ApplyState(const FInstancedStruct& InState) override;
};
