repo(card): ICardInventoryRepository.SetProtected surface
This commit is contained in:
@@ -26,6 +26,12 @@ public interface ICardInventoryRepository
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="createCounts">cardId → num_to_create. Empty dict is rejected by the caller.</param>
|
/// <param name="createCounts">cardId → num_to_create. Empty dict is rejected by the caller.</param>
|
||||||
Task<CreateOutcome> CreateCards(long viewerId, IReadOnlyDictionary<long, int> createCounts);
|
Task<CreateOutcome> CreateCards(long viewerId, IReadOnlyDictionary<long, int> createCounts);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle the <see cref="OwnedCardEntry.IsProtected"/> flag for a single card. Idempotent.
|
||||||
|
/// Accepts cards with Count=0 (preserves the destruct→re-craft round-trip invariant).
|
||||||
|
/// </summary>
|
||||||
|
Task<ProtectOutcome> SetProtected(long viewerId, long cardId, bool isProtected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -75,3 +81,14 @@ public enum CreateError
|
|||||||
WouldExceedMaxCopies,
|
WouldExceedMaxCopies,
|
||||||
InsufficientVials,
|
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,
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user