feat(inventory): scaffold InventoryService namespace types
Empty interfaces + records for IInventoryService, IInventoryTransaction, InventoryCommitResult, InventoryLoadConfig, InventoryCatalogException. Implementation lands in subsequent commits. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
30
SVSim.Database/Services/Inventory/IInventoryTransaction.cs
Normal file
30
SVSim.Database/Services/Inventory/IInventoryTransaction.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using SVSim.Database.Enums;
|
||||
using SVSim.Database.Models;
|
||||
using SVSim.Database.Services;
|
||||
|
||||
namespace SVSim.Database.Services.Inventory;
|
||||
|
||||
/// <summary>
|
||||
/// Scoped builder returned by <see cref="IInventoryService.BeginAsync"/>. Queue spend +
|
||||
/// grant operations; commit to save and assemble the <see cref="InventoryCommitResult"/>.
|
||||
/// <para>
|
||||
/// Dispose without committing rolls back the underlying DB transaction and detaches any
|
||||
/// in-memory mutations. <b>Always</b> wrap in <c>await using</c>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public interface IInventoryTransaction : IAsyncDisposable
|
||||
{
|
||||
Viewer Viewer { get; }
|
||||
bool IsFreeplay { get; }
|
||||
|
||||
Task<SpendResult> TrySpendAsync(SpendCurrency currency, long cost, CancellationToken ct = default);
|
||||
Task<SpendResult> TryDebitAsync(UserGoodsType type, long detailId, int num, CancellationToken ct = default);
|
||||
Task<IReadOnlyList<GrantedReward>> GrantAsync(UserGoodsType type, long detailId, int num, CancellationToken ct = default);
|
||||
Task<int> BackfillCardCosmeticsAsync(CancellationToken ct = default);
|
||||
|
||||
long EffectiveBalance(SpendCurrency currency);
|
||||
bool OwnsCard(long cardId);
|
||||
bool OwnsCosmetic(CosmeticType type, int id);
|
||||
|
||||
Task<InventoryCommitResult> CommitAsync(CancellationToken ct = default);
|
||||
}
|
||||
Reference in New Issue
Block a user