<?php
require_once __DIR__ . '/../auth.php';
require_once __DIR__ . '/../functions.php';
requireLogin();

$id = (int)($_GET['id'] ?? 0);
header('Content-Type: application/json');

if (!$id) {
    echo json_encode(['ok' => false]);
    exit;
}

$cliente = getClienteById($id);
if ($cliente) {
    echo json_encode(['ok' => true, 'cliente' => $cliente]);
} else {
    echo json_encode(['ok' => false]);
}