<?php
namespace Claromentis\Admin\Sysadmin\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"] ?: array()) + array("_a591754" . "a8ddcdbd" . "a9c80f1d" . "b4d911e1" . "4" => base64_decode("aXNfbnVsbA" . "=="));
use Background;
use Claromentis\Admin\Sysadmin\ServiceStatus;
use Date;
class GetBackgroundTaskStatus
{
    
    
    
    
    private $bg;
    protected $status;
    public function __construct(Background $_2bc6b5127a5a159e9c400fb12a33001c)
    {
        $this->bg = $_2bc6b5127a5a159e9c400fb12a33001c;
    }
    public function GetSummaryStatus() : int
    {
        
        
        
        list($_9dd403e612e4021b0c16604031047d6b, $_296e0cb517cba196d621eb2ca0f985ca, $_7f287f02a1c8eea54caa9c99097adfcd) = $this->bg->GetStatus();
        if ($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_a591754a8ddcdbda9c80f1db4d911e1" . "4"]($_9dd403e612e4021b0c16604031047d6b)) {
            return ServiceStatus::NEVER_RUN;
        }
        $_d230962d9a57dc6ba2b774d9ba3bb81e = new Date();
        $_1426d0309169d9f8d6748177957528f6 = $_d230962d9a57dc6ba2b774d9ba3bb81e->getDate(DATE_FORMAT_UNIXTIME) - $_9dd403e612e4021b0c16604031047d6b->getDate(DATE_FORMAT_UNIXTIME);
        if ($_1426d0309169d9f8d6748177957528f6 > 30 * 60 || $_1426d0309169d9f8d6748177957528f6 < 0) {
            $_e5e454c86d7039eba1beec13f61a7955 = ServiceStatus::ERROR;
        } elseif ($_1426d0309169d9f8d6748177957528f6 > 5 * 60) {
            $_e5e454c86d7039eba1beec13f61a7955 = ServiceStatus::WARNING;
        } else {
            $_e5e454c86d7039eba1beec13f61a7955 = ServiceStatus::OK;
        }
        if (!$_7f287f02a1c8eea54caa9c99097adfcd) {
            $_fe1707dde9b32da94bf5906dd85341ad = -1;
            if (!$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_a591754a8ddcdbda9c" . "80f1db4d911e14"]($_296e0cb517cba196d621eb2ca0f985ca)) {
                $_fe1707dde9b32da94bf5906dd85341ad = $_296e0cb517cba196d621eb2ca0f985ca->getDate(DATE_FORMAT_UNIXTIME) - $_9dd403e612e4021b0c16604031047d6b->getDate(DATE_FORMAT_UNIXTIME);
            }
            if ($_fe1707dde9b32da94bf5906dd85341ad < 0) {
                $_e5e454c86d7039eba1beec13f61a7955 = ServiceStatus::ERROR;
            }
        }
        return $_e5e454c86d7039eba1beec13f61a7955;
    }
    public function GetStatus() : array
    {
        if (empty($this->status)) {
            $this->status = $this->bg->GetStatus();
        }
        return $this->status;
    }
}