<?php

/**
 * Class BookingForm
 *
 * Handles the functionality related to displaying the booking form using shortcodes.
 */
namespace RadiusTheme\RadiusBooking\Shortcodes;

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

/**
 * Class BookingForm
 *
 * Responsible for managing and rendering the booking form functionality via shortcode integration.
 */
class BookingForm {

	/**
	 * Output booking form.
	 *
	 * Echoes the rendered template. Output is captured by
	 * Shortcodes::shortcode_wrapper() via ob_start().
	 *
	 * @param array|string $atts Shortcode attributes.
	 *
	 * @return void
	 */
	public static function output( $atts ): void {
		$atts = shortcode_atts(
			array(
				'modal' => 'false',
			),
			$atts,
			'radius_booking_form'
		);

		$atts['modal'] = filter_var( $atts['modal'], FILTER_VALIDATE_BOOLEAN );

		self::booking_form( $atts );
	}

	/**
	 * Render the booking form template.
	 *
	 * @param array $atts Normalized shortcode attributes.
	 *
	 * @return void
	 */
	private static function booking_form( $atts ) {
		rtrb_get_template( 'bookings/booking.php', array( 'atts' => $atts ) );
	}
}