<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

/**
 * RadiusBooking API Route Registrar
 *
 * This class is responsible for registering API routes dynamically with the WordPress REST API.
 * It supports CRUD operations and allows for middleware to be applied globally or per route.
 *
 * @package RadiusTheme\RadiusBooking\Core\Api\Routes
 */

use RadiusTheme\RadiusBooking\Models\Appointment;
use RadiusTheme\RadiusBooking\Models\CustomerBooking;

return array(

	Appointment::class . '.created'     => array(
		function ( $appointment ) {
			do_action( 'radius_booking_appointment_created', $appointment );
		},
	),

	Appointment::class . '.updated'     => array(
		function ( $appointment ) {
			do_action( 'radius_booking_appointment_updated', $appointment );
		},
	),

	CustomerBooking::class . '.created' => array(
		function ( $booking ) {
			do_action( 'radius_booking_booking_created', $booking );
			// Note: Email notifications are dispatched after payment is created in BookingService
			// to ensure payment/coupon data is available in the email template.
		},
	),

);
