| 1 |
<?php |
| 2 |
/** |
| 3 |
* Google Calendar Sync Class |
| 4 |
* |
| 5 |
* @package timetics |
| 6 |
*/ |
| 7 |
namespace Timetics\Core\Staffs\Calendars; |
| 8 |
|
| 9 |
use Timetics\Core\Integrations\Google\Service\Calendar; |
| 10 |
|
| 11 |
/** |
| 12 |
* Google calendar sync |
| 13 |
*/ |
| 14 |
class GoogleCalendarSync implements CalendarSyncInterface { |
| 15 |
|
| 16 |
/** |
| 17 |
* Sync booking to calendar |
| 18 |
* |
| 19 |
* @param array $bookingData [$bookingData description] |
| 20 |
* |
| 21 |
* @return bool [return description] |
| 22 |
*/ |
| 23 |
public function syncToCalendar( array $bookingData ): bool { |
| 24 |
// Implement Google Calendar API call |
| 25 |
return true; |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Sync with google calendar |
| 30 |
* |
| 31 |
* @param string $teamMemberId Team member id |
| 32 |
* |
| 33 |
* @return array Calendar Event List |
| 34 |
*/ |
| 35 |
public function fetchBookings( string $teamMemberId ): array { |
| 36 |
// Fetch bookings from Google Calendar API |
| 37 |
|
| 38 |
$calendar = new Calendar(); |
| 39 |
$events = $calendar->get_events( $teamMemberId ); |
| 40 |
|
| 41 |
if ( ! $events ) { |
| 42 |
return []; |
| 43 |
} |
| 44 |
|
| 45 |
return $events; |
| 46 |
} |
| 47 |
} |
| 48 |
|