package com.twu.biblioteca.userOperation;

import com.twu.biblioteca.Inputer;
import com.twu.biblioteca.LibraryElement.Book;
import com.twu.biblioteca.LibraryElement.BookList;
import com.twu.biblioteca.Printer;

import java.util.Optional;

public class Return implements Operation {
    private Printer printer;
    private Inputer inputer;
    private BookList bookList;

    public Return(Printer printer, Inputer inputer, BookList bookList) {
        this.printer = printer;
        this.inputer = inputer;
        this.bookList = bookList;
    }

    @Override
    public void operate() {
        printer.print("Please Input Book's Name:");
        Optional<Book> returnBook = bookList.getReturnableBook(inputer.input());
        if (returnBook.isPresent()) {
            bookList.returnBook(returnBook.get());
        }
    }

    @Override
    public String toString() {
        return "Return Book";
    }
}

@@ -276,16 +276,210 @@
 ation %7B%0A
+    public static final String SUCCESSFUL_RETURN_MESSAGE = %22Thank you for returning the book.%22;%0A    public static final String UNSUCCESSFUL_RETURN_MESSAGE = %22Thank you for returning the book.%22;%0A
     priv
@@ -998,24 +998,78 @@
 ook.get());%0A
+            printer.print(SUCCESSFUL_RETURN_MESSAGE);%0A
         %7D%0A  

add successful return message