import express from "express";
import { pool } from "../config/db.js";

const router = express.Router();

/** Authenticated read-only list for upload forms (country filter). */
router.get("/lookup/countries", async (req, res, next) => {
  try {
    const [rows] = await pool.query(
      "SELECT `country_id`, `country_name` FROM `country` ORDER BY `country_name` ASC"
    );
    res.json(rows);
  } catch (err) {
    next(err);
  }
});

export default router;
