'use strict';

/**
 * This class manages App Generator prompts.
 */
module.exports = class Prompt {

  /**
   * Ask the user to answer some questions.
   */
  static questions (generator) {
    return generator.prompt([{
      type: 'checkbox',
      name: 'ngModules',
      message: 'What Angular modules do you want?',
      store: true,
      choices: [
        {
          name: 'ngAnimate',
          value: 'ngAnimate'
        },
        {
          name: 'ngCookies',
          value: 'ngCookies'
        },
        {
          name: 'ngTouch',
          value: 'ngTouch'
        },
        {
          name: 'ngSanitize',
          value: 'ngSanitize'
        },
        {
          name: 'ngMessages',
          value: 'ngMessages'
        }
      ]
    }, {
      type: 'list',
      name: 'cssPreprocessor',
      message: 'Which CSS preprocessor do you want?',
      default: 'sass',
      store: true,
      choices: [
        {
          name: 'Sass (with Node-sass)',
          value: 'sass'
        },
        {
          name: 'Less',
          value: 'less'
        },
        {
          name: 'Plain CSS',
          value: 'css'
        }
      ]
    }]).then(answers => {
      // Angular modules
      generator.props.ngAnimate = answers.ngModules && answers.ngModules.includes('ngAnimate');
      generator.props.ngCookies = answers.ngModules && answers.ngModules.includes('ngCookies');
      generator.props.ngTouch = answers.ngModules && answers.ngModules.includes('ngTouch');
      generator.props.ngSanitize = answers.ngModules && answers.ngModules.includes('ngSanitize');
      generator.props.ngMessages = answers.ngModules && answers.ngModules.includes('ngMessages');

      // CSS preprocessor
      generator.props.cssPreprocessor = answers.cssPreprocessor;
    });
  }
};

@@ -782,16 +782,554 @@
 'list',%0A
+      name: 'resource',%0A      message: 'Would you like to use a REST resource library?',%0A      default: 'restangular',%0A      store: true,%0A      choices: %5B%0A        %7B%0A          name: 'Restangular, an alternative service to handles RESTful requests',%0A          value: 'restangular'%0A        %7D,%0A        %7B%0A          name: 'ngResource, the official support for RESTful services',%0A          value: 'ngResource'%0A        %7D,%0A        %7B%0A          name: 'None, $http is enough!',%0A          value: '$http'%0A        %7D%0A      %5D%0A    %7D, %7B%0A      type: 'list',%0A
       na
@@ -1347,24 +1347,24 @@
 processor',%0A
-
       messag
@@ -1725,16 +1725,17 @@
 rs =%3E %7B%0A
+%0A
       //
@@ -2129,24 +2129,24 @@
 Sanitize');%0A
-
       genera
@@ -2232,16 +2232,86 @@
 ges');%0A%0A
+      // Resource%0A      generator.props.resource = answers.resource;%0A%0A
       //

add resource related questions