package com.programmingskillz.domain;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.programmingskillz.constraint.ValidIsbn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import java.time.Instant;

/**
 * @author Durim Kryeziu
 */
@ApiModel(value = "Book", description = "Sample object that represents a book")
@JsonPropertyOrder({"id", "title", "author", "description", "isbn", "pages", "publisher", "published"})
@JacksonXmlRootElement(localName = "book")
public class Book {

    private String id;
    @NotNull(message = "{book.title.null}")
    private String title;
    @NotNull(message = "{book.author.null}")
    private String author;
    private String description;
    @ValidIsbn
    private String isbn;
    private String publisher;
    private Instant published;
    @NotNull(message = "{book.pages.null}")
    @Max(value = 32767, message = "{book.pages.max}")
    private Integer pages;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    @ApiModelProperty(required = true)
    public void setTitle(String title) {
        this.title = title;
    }

    public String getAuthor() {
        return author;
    }

    @ApiModelProperty(required = true)
    public void setAuthor(String author) {
        this.author = author;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getIsbn() {
        return isbn;
    }

    @ApiModelProperty(required = true, example = "9780137081073")
    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public Integer getPages() {
        return pages;
    }

    @ApiModelProperty(required = true)
    public void setPages(Integer pages) {
        this.pages = pages;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public Instant getPublished() {
        return published;
    }

    public void setPublished(Instant published) {
        this.published = published;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Book book = (Book) o;

        if (id != null ? !id.equals(book.id) : book.id != null) return false;
        if (title != null ? !title.equals(book.title) : book.title != null) return false;
        if (author != null ? !author.equals(book.author) : book.author != null) return false;
        if (description != null ? !description.equals(book.description) : book.description != null) return false;
        if (isbn != null ? !isbn.equals(book.isbn) : book.isbn != null) return false;
        if (pages != null ? !pages.equals(book.pages) : book.pages != null) return false;
        if (publisher != null ? !publisher.equals(book.publisher) : book.publisher != null) return false;
        return published != null ? published.equals(book.published) : book.published == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (author != null ? author.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (isbn != null ? isbn.hashCode() : 0);
        result = 31 * result + (pages != null ? pages.hashCode() : 0);
        result = 31 * result + (publisher != null ? publisher.hashCode() : 0);
        result = 31 * result + (published != null ? published.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Book{" +
                "id='" + id + '\'' +
                ", title='" + title + '\'' +
                ", author='" + author + '\'' +
                ", description='" + description + '\'' +
                ", isbn='" + isbn + '\'' +
                ", pages=" + pages +
                ", publisher='" + publisher + '\'' +
                ", published=" + published +
                '}';
    }
}
@@ -1173,32 +1173,104 @@
 turn id;%0A    %7D%0A%0A
+    @ApiModelProperty(example = %22767a463c-4cc3-48c1-b93e-25c0d216032b%22)%0A
     public void 
@@ -1284,24 +1284,24 @@
 tring id) %7B%0A
-
         this
@@ -1406,32 +1406,74 @@
 (required = true
+, example = %22Effective Java (2nd Edition)%22
 )%0A    public voi
@@ -1625,32 +1625,58 @@
 (required = true
+, example = %22Joshua Bloch%22
 )%0A    public voi
@@ -2029,17 +2029,17 @@
 9780
-137081073
+321356680
 %22)%0A 
@@ -2207,16 +2207,33 @@
 d = true
+, example = %22364%22
 )%0A    pu
@@ -2524,32 +2524,88 @@
 blished;%0A    %7D%0A%0A
+    @ApiModelProperty(example = %222008-05-28T00:00:00Z%22)%0A
     public void 

Add some example values for Book object