// (C) Copyright 2020 Hewlett-Packard Enterprise Company, L.P.
define([ 'hp/services/REST','jquery'],
function(REST) {"use strict";

   var ApplianceShutdownService = (function() {
        
        var action; 
        function ApplianceShutdownService() {

         
            /**
            * @constructor Singleton class containing service logic for the appliance 
            *              shutdown and reboot   
            * @type {ApplianceShutdownService}
            */
        
             this.startApplianceShutdown = function(rebootOption,  handlers) { 
                
                if (rebootOption) { // if option is true 
                   action = 'REBOOT';
                } else {
                   action = 'HALT'; 
                }            
                REST.postObject('/rest/appliance/shutdown?type=' + action, null, handlers);
            };
           
        }
  
        return new ApplianceShutdownService();
    }());

    return ApplianceShutdownService;
});