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

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

$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
$appointmentTypes = $opticianService->getAppointmentTypes($siteId, $password, $siteInfo);

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