<?php
require_once 'shareService.php';

header('Content-Type: application/json');

if (
    !isset($_GET['modulo']) ||
    !isset($_GET['campo_id']) ||
    !isset($_GET['id'])
) {
    http_response_code(400);
    echo json_encode(['error' => 'Parámetros incompletos']);
    exit;
}

$link = ShareService::generarLink(
    $_GET['modulo'],
    $_GET['campo_id'],
    (int)$_GET['id']
);

echo json_encode(['link' => $link]);
