namespace NeonSprawl.Server.Game.Gathering;

/// <summary>Persisted remaining gathers per world resource-node instance (NEO-61).</summary>
public interface IResourceNodeInstanceStore
{
    /// <summary>Reads the current snapshot when a row exists for <paramref name="interactableId"/>.</summary>
    bool TryGetRemainingGathers(string interactableId, out ResourceNodeInstanceSnapshot snapshot);

    /// <summary>
    /// Creates a row at <paramref name="initialRemainingGathers"/> when absent; no-op when a row already exists.
    /// </summary>
    bool TryEnsureInitialized(string interactableId, int initialRemainingGathers);

    /// <summary>
    /// Atomically decrements when <c>remaining &gt; 0</c>. Returns <c>false</c> when the row is missing or already
    /// depleted.
    /// </summary>
    bool TryDecrementRemainingGathers(
        string interactableId,
        out int previousRemaining,
        out int remainingGathers);
}
