public function retrieveAppointments($user_type, $email, $appointment_cat)
 {
     include_once "DatabaseBook.class.php";
     $db = DatabaseBook::getInstance();
     $mysqli = $db->getConnection();
     if ($user_type == "Captain") {
         $query = "select * from ea_appointments as ap inner join ea_users as usr on ap.id_users_providers = usr.id where usr.email = '{$email}'";
     } elseif ($user_type == "Customer") {
         $query = "select * from ea_appointments as ap inner join ea_users as usr on ap.id_users_customer = usr.id where usr.email = '{$email}'";
     }
     if ($appointment_cat == "past") {
         $query .= " AND ap.end_datetime < curdate()";
     } elseif ($appointment_cat == "upcoming") {
         $query .= " AND ap.start_datetime > curdate()";
     }
     $result = $mysqli->query($query);
     $counter = 0;
     $list = array();
     while ($news_row = $result->fetch_array()) {
         $appointment = new Appointment();
         //$appointment = $appointment->createObject($appointment,$news_row);
         $appointment->setAppointmentId($news_row[0]);
         $appointment->setAppointmentDate($news_row['start_datetime']);
         //  $appointment -> setAppointmentDeposit($news_row['appointment_deposit']);
         //  $appointment -> setHullId($news_row['hull_id']);
         $appointment->setUserId($news_row['id_users_customer']);
         $appointment->setCaptainId($news_row['id_users_provider']);
         // $appointment -> setAppointmentStatus($news_row['appointment_status']);
         $list[$counter] = $appointment;
         $counter++;
     }
     return $list;
 }