<?php
include_once '../config/header.php';
include_once '../config/helper.php';
include_once '../config/database.php';
include_once '../objects/api_auth.php';
include_once '../token/validatetoken.php';

$database = new Database();
$db = $database->getConnection();

$api_auth = new Api_Auth($db);

$api_auth->id = isset($_GET['id']) ? $_GET['id'] : die();
$api_auth->readOne();
 
if($api_auth->id!=null){
    $api_auth_arr = array(
        
"id" => $api_auth->id,
"user" => html_entity_decode($api_auth->user),
"pass" => html_entity_decode($api_auth->pass)
    );
    http_response_code(200);
   echo json_encode(array("status" => "success", "code" => 1,"message"=> "api_auth found","document"=> $api_auth_arr));
}
else{
    http_response_code(404);
	echo json_encode(array("status" => "error", "code" => 0,"message"=> "api_auth does not exist.","document"=> ""));
}
?>
