<?php
require 'conexionbd.php';

$artista = $_GET['artista'] ?? '';
$dia = $_GET['dia'] ?? '';

if (empty($artista) || empty($dia)) {
    die(json_encode(['error' => 'Faltan parĂ¡metros (artista y dia).']));
}

try {
    $stmt = $conn->prepare("SELECT id, asiento, estado, precio FROM asientos WHERE artista = :artista AND dia = :dia");
    $stmt->execute([':artista' => $artista, ':dia' => $dia]);
    $asientos = $stmt->fetchAll(PDO::FETCH_ASSOC);

    echo json_encode(['success' => true, 'asientos' => $asientos]);
} catch (PDOException $e) {
    die(json_encode(['error' => 'Error al consultar los asientos: ' . $e->getMessage()]));
}
?>