<?php
include_once __DIR__ . '/../config/database.php';

class TurnoController
{
    private $db;

    public function __construct()
    {
        $database = new Database();
        $this->db = $database->getConnection();
    }

    public function listarTurnos()
    {
        try {
            $query = "SELECT id, turno FROM turnos WHERE estado = 1";
            $stmt = $this->db->prepare($query);
            $stmt->execute();
            return $stmt->fetchAll(PDO::FETCH_ASSOC);
        } catch (PDOException $e) {
            error_log("Error al listar turnos: " . $e->getMessage());
            return [];
        }
    }
}
?>
