<?php

	if ($_SERVER["REQUEST_METHOD"] == "POST") {
		import_file(DIR_MODELS."Model.class.php");

		$id_usuario = (int) filter_input(INPUT_POST, "id_usuario", FILTER_SANITIZE_NUMBER_INT);

		$model = new Model();

		$result = $model->query("
			SELECT * FROM usuario 
			WHERE 
				id_usuario = :id 
		", [
			":id" => $id_usuario
		]);

		if ($result->rowCount() > 0) {
			$response = ["status" => true];

			foreach ($result->fetchAll() as $key => $value) {
				foreach ($value as $k => $v) {
					$response["data"][$key][$k] = $v;
				}
			}

			echo json_encode($response);
		}
		else{
			echo json_encode(["status" => false]);
		}
	}
	else{
		show_403();
	}


?>