<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace ModulesGarden\HostingQuotaNotifications\App\Libs\Cron\Notifications\Actions;

use \ModulesGarden\HostingQuotaNotifications\App\Helper\Api;
use \ModulesGarden\HostingQuotaNotifications\App\Helper\Logger\Log;
use \ModulesGarden\HostingQuotaNotifications\App\Libs\Cron\Notifications\Actions\Base;
use \ModulesGarden\HostingQuotaNotifications\App\Helper\Models\Hosting as HostingModelHelper;
use \ModulesGarden\HostingQuotaNotifications\App\Helper\Basics\Converter;

/**
 * Description of Service
 *
 * @author Artur Pilch <artur.pi@modulesgarden.com>
 */
class Service extends Base
{

    public function run()
    {
        if ($this->data['action'] == 'none')
        {
            return;
        }
        
        $command = sprintf('Module%s', ucfirst($this->data['action']));
        $params  = $this->getParams();
        
        $result  = Api::apiCall($command, $params);
        
        Log::log($command, $params, $result, $this->data);
    }

    public function getParams()
    {
        return [
            'accountid' => $this->data['hostingId'],
        ];
    }
}
