<?php
include_once(__DIR__."/api-common.php");
include_once(__DIR__."/../my-optician-wsdl-service/MyOpticianWsdlService.php");
global $service_url, $optician_id;

// Instantiate the MyOpticianWsdlService class
$opticianService = new MyOpticianWsdlService($service_url, $optician_id);
checkGet();

$siteId = null;
if(isset($_GET['site_id']))
    $siteId = $_GET['site_id'];
else{
    $siteInfo = $opticianService->getSiteInfo($optician_id, $password);
    $siteId = $siteInfo->getSite();
    $password = $siteInfo->getPassword();
}
// Call the getAppointmentTypes method
$shops = $opticianService->getShops($siteId, $password);

// Output the result as JSON
header('Content-Type: application/json');
echo json_encode(['data'=>$shops]);
?>