'use strict';

const Promise = require('bluebird'),
    mlb = require('../utils/mlb');

/**
 * @name cornelius.getRoster
 * @description Takes a team's ID and returns their 40 man roster.
 *
 * `options` should be an object.
 * If you provide no team ID, or an incorrect one, `getRoster` returns an empty array.
 * @summary Get a team's 40 man roster.
 *
 * @public
 * @param {Object} options - Options object.
 * @param {string} options.team_id - Team's ID.
 * @param {boolean} [options.short=false] - Return full player info with roster.
 * @param {boolean} [options.prune=true] - Prune the data.
 * @returns {Array | Object} - Pruned roster *or* MLB `roster_40` JSON data.
 * @example <caption>Get a team's roster by ID</caption>
 * cornelius.getRoster({ team_id: '121' }) // New York Mets
 *   .then(function (data) {
 *     // do stuff with roster data
 *   })
 *   .catch(function (error) {
 *     // handle error
 *   });
 */
function getRoster(options) {
    return new Promise(function (resolve, reject) {
        mlb.roster(options)
            .then(data => {
                resolve(data);
            })
            .catch(error => {
                reject(error);
            });
    });
}

module.exports = getRoster;

@@ -165,24 +165,316 @@
 ns their 40 
+man, or all time roster.%0A * %0A * The %60season%60 property is a string of two years which mark the start and end seasons of the%0A * all time rosters you're requesting. Providing a single year will return only that years roster.%0A * %0A * Omitting the %60season%60 property will return a team's current 40 
 man roster.%0A
@@ -469,24 +469,24 @@
 man roster.%0A
-
  *%0A * %60optio
@@ -744,16 +744,80 @@
 m's ID.%0A
+ * @param %7Bstring%7D %5Boptions.season%5D - Season to get roster for.%0A
  * @para
@@ -1013,16 +1013,40 @@
 ster_40%60
+ %7C %60roster_team_alltime%60
  JSON da
@@ -1166,16 +1166,16 @@
 rk Mets%0A
-
  *   .th
@@ -1302,16 +1302,324 @@
 *   %7D);%0A
+ * @example %3Ccaption%3EGet a team's cumulative roster for the seasons beginning 2016 and ending 2017%3C/caption%3E%0A * cornelius.getRoster(%7B team_id: '121', season: '2016 2017' %7D)%0A *   .then(function(data) %7B%0A *     // do stuff with roster data%0A *   %7D)%0A *   .catch(function (error) %7B%0A *     // handle error%0A *   %7D);%0A
  */%0Afunc

update getRoster docs for new all time roster functionality