From b64123a9aa5df2326df3c029a27aae0458e5594a Mon Sep 17 00:00:00 2001 From: gamer147 Date: Thu, 28 May 2026 01:42:50 -0400 Subject: [PATCH] repo(card): ICardInventoryRepository.SetProtected surface --- .../Card/ICardInventoryRepository.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/SVSim.Database/Repositories/Card/ICardInventoryRepository.cs b/SVSim.Database/Repositories/Card/ICardInventoryRepository.cs index 90bb475..bedb6f4 100644 --- a/SVSim.Database/Repositories/Card/ICardInventoryRepository.cs +++ b/SVSim.Database/Repositories/Card/ICardInventoryRepository.cs @@ -26,6 +26,12 @@ public interface ICardInventoryRepository /// /// cardId → num_to_create. Empty dict is rejected by the caller. Task CreateCards(long viewerId, IReadOnlyDictionary createCounts); + + /// + /// Toggle the flag for a single card. Idempotent. + /// Accepts cards with Count=0 (preserves the destruct→re-craft round-trip invariant). + /// + Task SetProtected(long viewerId, long cardId, bool isProtected); } /// @@ -75,3 +81,14 @@ public enum CreateError WouldExceedMaxCopies, InsufficientVials, } + +public sealed record ProtectOutcome(bool IsSuccess, ProtectError? Error) +{ + public static ProtectOutcome Ok() => new(true, null); + public static ProtectOutcome Fail(ProtectError e) => new(false, e); +} + +public enum ProtectError +{ + UnknownCard, +}