package dynamo.model.ebooks.books;

import java.nio.file.Path;
import java.util.Date;

import dynamo.backlog.tasks.files.FileUtils;
import dynamo.core.Language;
import dynamo.ebooks.model.EBook;
import dynamo.model.Downloadable;
import dynamo.model.DownloadableStatus;

public class Book extends Downloadable implements EBook {

	private String author;
	private Language language;

	public Book(Long id, DownloadableStatus status, String aka, String name, String author, Language language, Date creationDate) {
		super(id, name, null, status, aka, -1, creationDate);
		this.author = author;
		this.language = language;
	}

	public String getAuthor() {
		return author;
	}

	public Language getLanguage() {
		return language;
	}

	@Override
	public String getRelativeLink() {
		// FIXME
		return isDownloaded() ? "books-collection.jsf" : "books-kiosk.jsf";
	}

	@Override
	public Path determineDestinationFolder() {
		return FileUtils.getFolderWithMostUsableSpace(BookManager.getInstance().getFolders());
	}
	
	@Override
	public String toString() {
		return String.format("%s - %s (%s)", getName(), author, language != null ? language.getLabel() : "Unknown Language");
	}

}

@@ -774,85 +774,46 @@
 %7B%0A%09%09
-// FIXME%0A%09%09return isDownloaded() ? %22books-collection.jsf%22 : %22books-kiosk.jsf%22
+return %22#/books/%22 + getStatus().name()
 ;%0A%09%7D

Fix Book relative links