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

class ModalidadController
{
    private $db;

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

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