const db = require("../../busapi/configs/dbConnection");

const searchHotelLocations = async (keyword) => {

  const query = `
      SELECT 
        location_code,
        location_name,
        country,
        state,
        latitude,
        longitude
      FROM hotel_locations
      WHERE location_name LIKE CONCAT(?, '%')
         OR location_code LIKE CONCAT(?, '%')
      LIMIT 15
  `;

  const [rows] = await db.execute(query, [keyword, keyword]);

  return rows;
};

module.exports = {
  searchHotelLocations
};