<?php
include 'db.php';
include 'auth.php';
require_right('Edit Items');

$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$item = $conn->query("SELECT * FROM items WHERE id = $id")->fetch_assoc();

if (!$item) {
    http_response_code(404);
    echo json_encode(['error' => 'Item not found']);
    exit;
}

echo json_encode($item); 