/**
 * Created by fran lopez on 8/12/15.
 */

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with two arguments: The base
     * URL for the resource endpoints and a routing parameter assignment
     * using the book's document title field.
     */

    angular.module('books').factory('BooksByTitle', ['$resource',
        function ($resource) {
            return $resource('/books/booksByTitle/:patternForBookTitle', {
                patternForBookTitle: '@title'
            });
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with two arguments: The base
     * URL for the resource endpoints and a routing parameter assignment
     * using the book's document year field.
     */

    angular.module('books').factory('BooksByYear', ['$resource',
        function ($resource) {
            return $resource('/books/booksByYear/:bookYear', {
                bookYear: '@publicationDate'
            });
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with two arguments: The base
     * URL for the resource endpoints and a routing parameter assignment
     * using the book's document genre field.
     */

    angular.module('books').factory('BooksByGenre', ['$resource',
        function ($resource) {
            return $resource('/books/booksByGenre/:bookGenre', {
                bookGenre: '@genre'
            });
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with two arguments: The base
     * URL for the resource endpoints and a routing parameter assignment
     * using the book's document protagonist field.
     */

    angular.module('books').factory('BooksByProtagonist', ['$resource',
        function ($resource) {
            return $resource('/books/booksByProtagonist/:patternForBookProtagonist', {
                patternForBookProtagonist: '@protagonist'
            });
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with two arguments: The base
     * URL for the resource endpoints and a routing parameter assignment
     * using the book's document director field.
     */

    angular.module('books').factory('BooksByWriter', ['$resource',
        function ($resource) {
            return $resource('/books/booksByWriter/:patternForBookWriter', {
                patternForBookWriter: '@writer'
            });
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with two arguments: The base
     * URL for the resource endpoints and a routing parameter assignment
     * using the book's document rating field.
     */

    angular.module('books').factory('BooksByRating', ['$resource',
        function ($resource) {
            return $resource('/books/booksByRating/:bookRating', {
                bookRating: '@rating'
            });
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with one argument: The base
     * URL for the resource endpoints.
     */

    angular.module('books').factory('ListBookYears', ['$resource',
        function ($resource) {
            return $resource('/listOfBookYears', {});
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with one argument: The base
     * URL for the resource endpoints.
     */

    angular.module('books').factory('ListBookGenres', ['$resource',
        function ($resource) {
            return $resource('/listOfBookGenres', {});
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with one argument: The base
     * URL for the resource endpoints.
     */

    angular.module('books').factory('ListBookRatings', ['$resource',
        function ($resource) {
            return $resource('/listOfBookRatings', {});
        }
    ]);

    /**
     * AngularJS service that will utilize the "$resource" factory method.
     * The service uses the "$resource" factory with two arguments: The base
     * URL for the resource endpoints and a routing parameter assignment
     * using the book's document id field.
     */

    angular.module('books').factory('BookDetails', ['$resource',
        function ($resource) {
            return $resource('/books/:bookId', {
                bookId: '@_id'
            });
        }
    ]);