if (!flight.isOpen()) {
throw new BadRequestException("Flight closed.");
}
String ridString = "FAILED";
final int nextRid = flight.nextReservationNumber();
if (nextRid > 0) {
ridString = String.format("%s-%03d", flight.getId(), nextRid);
}
return ridString;
}