<?php

if (empty($_GET['restaurant_id'])) {
    header('Location: index.php');
} else {
    require_once '../lib/Restaurant.class.php';
    require_once '../lib/User.class.php';
    require_once '../lib/Review.class.php';
    require_once '../lib/Image.class.php';
    require_once '../lib/helper.functions.php';
    $restaurant = new Restaurant();
    if ($restaurant->find($_GET['restaurant_id'])) {
        $restaurant_info = $restaurant->get_restaurant_info();
        $restaurant_raw_data = $restaurant->get_raw_data();
        $image = new Image();
        if ($image->find($restaurant_info['restaurant_id'])) {
            $image_path = $image->get_medium();
        }
        $review = new Review();
        if ($review->find_reviews_by_restaurant_id($_GET['restaurant_id'])) {
            $reviews_data = $review->get_reviews_raw_data();
        }
    } else {
        header('Location: index.php');
    }
}
require_once '../templates/header.php';
if (isset($_SESSION['login_user_id'])) {
    $current_user_id = $_SESSION['login_user_id'];
}
?>