/**
 * 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 film's document title field.
     */

    angular.module('films').factory('FilmsByTitle', ['$resource',
        function ($resource) {
            return $resource('/films/filmsByTitle/:patternForFilmTitle', {
                patternForFilmTitle: '@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 film's document year field.
     */

    angular.module('films').factory('FilmsByYear', ['$resource',
        function ($resource) {
            return $resource('/films/filmsByYear/:filmYear', {
                filmYear: '@year'
            });
        }
    ]);

    /**
     * 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 film's document genre field.
     */

    angular.module('films').factory('FilmsByGenre', ['$resource',
        function ($resource) {
            return $resource('/films/filmsByGenre/:filmGenre', {
                filmGenre: '@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 film's document protagonist field.
     */

    angular.module('films').factory('FilmsByProtagonist', ['$resource',
        function ($resource) {
            return $resource('/films/filmsByProtagonist/:patternForFilmProtagonist', {
                patternForFilmProtagonist: '@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 film's document director field.
     */

    angular.module('films').factory('FilmsByDirector', ['$resource',
        function ($resource) {
            return $resource('/films/filmsByDirector/:patternForFilmDirector', {
                patternForFilmDirector: '@director'
            });
        }
    ]);

    /**
     * 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 film's document rating field.
     */

    angular.module('films').factory('FilmsByRating', ['$resource',
        function ($resource) {
            return $resource('/films/filmsByRating/:filmRating', {
                filmRating: '@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('films').factory('ListFilmYears', ['$resource',
        function ($resource) {
            return $resource('/listOfFilmYears', {});
        }
    ]);

    /**
     * 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('films').factory('ListFilmGenres', ['$resource',
        function ($resource) {
            return $resource('/listOfFilmGenres', {});
        }
    ]);

    /**
     * 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('films').factory('ListFilmRatings', ['$resource',
        function ($resource) {
            return $resource('/listOfFilmRatings', {});
        }
    ]);

    /**
     * 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 film's document id field.
     */

    angular.module('films').factory('FilmDetails', ['$resource',
        function ($resource) {
            return $resource('/films/:filmId', {
                filmId: '@_id'
            });
        }
    ]);