package com.twu.biblioteca.controllers;

import com.twu.biblioteca.models.Section;
import com.twu.biblioteca.views.View;

public class BooksController {
    private Section section;
    private View view;

    public BooksController(Section section, View view) {
        this.section = section;
        this.view = view;
    }

    public void listAvailableBooks() {
        String bookDetails = section.availableItems();
        view.write(bookDetails);
    }

    public void checkoutABook() {
        String title = view.read();
        if(section.checkoutItem(title)) {
            view.write("Thank you! Enjoy the book.");
        }
        else {
            view.write("That book is not available.");
        }
    }

    public void returnABook() {
        String title = view.read();
        if(section.returnItem(title)) {
            view.write("Thank you for returning the book.");
        }
        else {
            view.write("That is not a valid book to return.");
        }
    }
}
@@ -162,25 +162,29 @@
 ate Section 
-s
+bookS
 ection;%0A    
@@ -238,17 +238,21 @@
 Section 
-s
+bookS
 ection, 
@@ -277,17 +277,21 @@
    this.
-s
+bookS
 ection =
@@ -291,17 +291,21 @@
 ction = 
-s
+bookS
 ection;%0A
@@ -405,17 +405,21 @@
 tails = 
-s
+bookS
 ection.a
@@ -552,25 +552,29 @@
 %0A        if(
-s
+bookS
 ection.check
@@ -821,17 +821,21 @@
      if(
-s
+bookS
 ection.r

Renamed private field section to booksSection