var inquirer = require('inquirer');
var fs = require('fs')
var path = require('path')

var questions = [{
        type: 'input',
        name: 'clientId',
        message: 'Please enter your clientId'
    },
    {
        type: 'input',
        name: 'clientSecret',
        message: 'Please enter your clientSecret'
    },
    {
        type: 'input',
        name: 'redirectUri',
        message: 'Please enter your redirectUri'
    },
    {
        type: 'input',
        name: 'device',
        message: 'Please enter your device name to play music on'
    },
    {
        type: 'input',
        name: 'path',
        message: 'Where is your floppy drive mounted?'
    }
];

inquirer.prompt(questions).then(answers => {
    fs.writeFile((path.resolve(__dirname, "../data/userDetails.json")), JSON.stringify(answers), function (err) {
        if (err) return console.log(err);
        console.log(`User Details Written to File`);
      });
    console.log(JSON.stringify(answers, null, '  '));
});