using SVSim.Database.Enums; using SVSim.Database.Models; using SVSim.Database.Services; namespace SVSim.Database.Services.Inventory; /// /// Scoped builder returned by . Queue spend + /// grant operations; commit to save and assemble the . /// /// Dispose without committing rolls back the underlying DB transaction and detaches any /// in-memory mutations. Always wrap in await using. /// /// public interface IInventoryTransaction : IAsyncDisposable { Viewer Viewer { get; } bool IsFreeplay { get; } Task TrySpendAsync(SpendCurrency currency, long cost, CancellationToken ct = default); Task TryDebitAsync(UserGoodsType type, long detailId, int num, CancellationToken ct = default); Task> GrantAsync(UserGoodsType type, long detailId, int num, CancellationToken ct = default); Task BackfillCardCosmeticsAsync(CancellationToken ct = default); long EffectiveBalance(SpendCurrency currency); bool OwnsCard(long cardId); bool OwnsCosmetic(CosmeticType type, int id); Task CommitAsync(CancellationToken ct = default); }