// Path: rest-client/src/main/java/com/readlearncode/dukesbookshop/domain/Author.java
// public class Author implements Serializable {
// 
//     private String id;
//     private String firstName;
//     private String lastName;
//     private String blogURL;
// 
//     public Author(){}
// 
//     public Author(String firstName, String lastName){
//         this.id = UUID.randomUUID().toString();
//         this.firstName = firstName;
//         this.lastName = lastName;
//     }
// 
//     public Author(String firstName, String lastName, String blogURL){
//         this(firstName, lastName);
//         this.blogURL = blogURL;
//     }
// 
//     public Author(String id, String firstName, String lastName, String blogURL){
//         this(firstName, lastName, blogURL);
//         this.id = id;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     public void setFirstName(String firstName) {
//         this.firstName = firstName;
//     }
// 
//     public String getLastName() {
//         return lastName;
//     }
// 
//     public void setLastName(String lastName) {
//         this.lastName = lastName;
//     }
// 
//     public String getBlogURL() {
//         return blogURL;
//     }
// 
//     public void setBlogURL(String blogURL) {
//         this.blogURL = blogURL;
//     }
// 
//     @Override
//     public String toString() {
//         return "Author{" +
//                 "id='" + id + '\'' +
//                 ", firstName='" + firstName + '\'' +
//                 ", lastName='" + lastName + '\'' +
//                 ", blogURL='" + blogURL + '\'' +
//                 '}';
//     }
// }


import com.readlearncode.dukesbookshop.domain.Author;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.json.JsonArray;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import java.util.Collections;
import java.util.List;
package com.readlearncode.dukesbookshop.restclient;



/**
 * Source code github.com/readlearncode
 *
 * @author Alex Theedom www.readlearncode.com
 * @version 1.0
 */
@ApplicationScoped
public class AuthorServiceImpl implements AuthorService {

    private static final String API_URL = "http://localhost:8081/rest-server";
    private static final String AUTHORS_ENDPOINT = API_URL + "/api/authors";

    private Client client;

    @Inject
    private BookService bookService;

    @PostConstruct
    public void initialise() {
        client = ClientBuilder.newClient();
    }


    @Override
// Path: rest-client/src/main/java/com/readlearncode/dukesbookshop/domain/Author.java
// public class Author implements Serializable {
// 
//     private String id;
//     private String firstName;
//     private String lastName;
//     private String blogURL;
// 
//     public Author(){}
// 
//     public Author(String firstName, String lastName){
//         this.id = UUID.randomUUID().toString();
//         this.firstName = firstName;
//         this.lastName = lastName;
//     }
// 
//     public Author(String firstName, String lastName, String blogURL){
//         this(firstName, lastName);
//         this.blogURL = blogURL;
//     }
// 
//     public Author(String id, String firstName, String lastName, String blogURL){
//         this(firstName, lastName, blogURL);
//         this.id = id;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     public void setFirstName(String firstName) {
//         this.firstName = firstName;
//     }
// 
//     public String getLastName() {
//         return lastName;
//     }
// 
//     public void setLastName(String lastName) {
//         this.lastName = lastName;
//     }
// 
//     public String getBlogURL() {
//         return blogURL;
//     }
// 
//     public void setBlogURL(String blogURL) {
//         this.blogURL = blogURL;
//     }
// 
//     @Override
//     public String toString() {
//         return "Author{" +
//                 "id='" + id + '\'' +
//                 ", firstName='" + firstName + '\'' +
//                 ", lastName='" + lastName + '\'' +
//                 ", blogURL='" + blogURL + '\'' +
//                 '}';
//     }
// }


// Path: rest-client/src/main/java/com/readlearncode/dukesbookshop/restclient/AuthorServiceImpl.java
import com.readlearncode.dukesbookshop.domain.Author;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.json.JsonArray;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import java.util.Collections;
import java.util.List;

package com.readlearncode.dukesbookshop.restclient;



/**
 * Source code github.com/readlearncode
 *
 * @author Alex Theedom www.readlearncode.com
 * @version 1.0
 */
@ApplicationScoped
public class AuthorServiceImpl implements AuthorService {

    private static final String API_URL = "http://localhost:8081/rest-server";
    private static final String AUTHORS_ENDPOINT = API_URL + "/api/authors";

    private Client client;

    @Inject
    private BookService bookService;

    @PostConstruct
    public void initialise() {
        client = ClientBuilder.newClient();
    }


    @Override
    public List<Author> getAuthors() {