public Result <CustomerQueue> RevokeCustomer(CounterName counterName) => AvailableCounters.GetMaybeServingTicket(counterName) .OnSuccess(maybeServingTicket => maybeServingTicket.Map( servingTicket => ApplyChange(new CustomerRevoked(Id, counterName, servingTicket.Id)))) .ToTypedResult(this);
public Result <CustomerQueue> TakeNextCustomer(CounterName counterName) => AvailableCounters .GetMaybeServingTicket(counterName) .OnSuccess(maybeServingTicketId => ApplyCustomerServedIfTicketIsBeingServed(maybeServingTicketId, counterName)) .OnSuccess(_ => ApplyCustomerTakenIfThereIsPendingTicketInTheQueue(counterName)) .ToTypedResult(this);