using System; using System.Collections.Generic; using System.Linq; using BoundaryLab.Domain; namespace BoundaryLab.Application; public interface IReserve { bool Reserve(int units); } public interface ICapacity { int Free { get; } void Commit(int units); } public sealed class ReserveService(ICapacity capacity) : IReserve { public bool Reserve(int units) { if (!CapacityRule.CanTake(units, capacity.Free)) return false; capacity.Commit(units); return true; } }