class RequestOrgan implements Runnable {

    @Override
    public void run() {
        // requestorgan -u 1 -o liver
        Optional<Client> client = manager.getClientByID(uid);
        if (!client.isPresent()) {
            outputStream.println("No client exists with that user ID");

        } else if (organType == null) {
            outputStream.println("The type of organ to be donated has not been defined.");

        } else {
            boolean organCurrentlyRequested = false;

            // Iterate through each transplant request for the client,
            // checking if they have already requested this organ
            for (TransplantRequest tr : client.get().getTransplantRequests()) {
                if (tr.getRequestedOrgan() == organType && tr.getStatus() == TransplantRequestStatus.WAITING) {
                    organCurrentlyRequested = true;
                    break;
                }
            }

            if (organCurrentlyRequested) {
                outputStream.println("This organ is already requested.");
            } else {
                TransplantRequest newRequest = new TransplantRequest(client.get(), organType);
                Action action = new AddTransplantRequestAction(client.get(), newRequest, manager);

                outputStream.println(invoker.execute(action));
            }
        }
    }

    public  RequestOrgan(PrintStream outputStream, ActionInvoker invoker);
    public  RequestOrgan(ClientManager manager, ActionInvoker invoker);

}