<?php
require_once __DIR__ . '/../../api-user-check.php';
require_once __DIR__ . '/../../php/locations/locations.php';

if ($loc = $_GET['loc'] ?? false) {
    if ($lang = $_GET['lang'] ?? false) {
        $match = Locations::get_location($loc, $lang);
    } else {
        $match = Locations::get_location($loc);
    }

    header('Content-Type: application/json');
    echo json_encode($match);
} else {
    http_response_code(400);
}
