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

$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"] = (@$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] ?: array()) + array("_a591754a8ddcdb" . "da9c80f1db4d911" . "e14" => base64_decode("aXNf" . "bnVs" . "bA=="));
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["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_a591754a8ddcdbda9c80f1db4d" . "911e14"]($_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["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_a591754a8ddcdbda9c80f1" . "db4d911e14"]($_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;
    }
}