<?php
//////////////////////////////////////
header("Access-Control-Allow-Origin: *");
include_once('OAuth.php');
//////////// SAAS ENV ////////////////////////////////////////////////////
require_once("class.restframework.php");
require_once("class.saas.php");
include_once('class.booking.php');
////////////////////////////////////////////////////////////////////////
$restapi = new RestFrameWork();
// alow get ######## 
$restapi->allow("get");
// only allow get method
$saas = new SaaS($restapi);
$auth = $saas->_initAuth();
////////////////////////////////////////////////////////////////////////
$booking = new Booking($auth, $restapi);
///////////////////////////////////////////////////////////////////////
if ($restapi->purge("service_id")) {
    $service_id = $_GET["service_id"];
    $response = $booking->getRoomServiceById($service_id);
    if ($response["success"]) {
        echo $restapi->Response($response);
    } else {
        echo $restapi->Response($response, 400);
    }
} else {
    $response = $booking->getAllRoomServices();
    echo $restapi->Response($response);
}
