<?php
include(__DIR__ . '/../includes/functions.php');

$pop = $db->select('pop', '*', 'id = :id', '', [':id' => 1]);
$status = $pop[0]['status'] ?? 'disable';
$link = $pop[0]['link']?? 'empty';
$uuid = $pop[0]['uuid']?? 'empty';


if($status == 'disable' || $link == 'empty' || $uuid == 'empty'){
    output("disable" , "empty", "empty", "error");
}else{
    output($status , $link, $uuid, "ok");
}



function output($status,$link,$uuid,$type) {
    $response;
    
    if($type == "error"){
        $response = [ "status" => "disable","uuid" => $uuid , "link" => $link];
    }else{
        $response = [ "status" => $status,"uuid" => $uuid , "link" => $link];
    }
    
    
	header('Content-type: application/json; charset=UTF-8');
	echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
    
?>