<?php
/**
 * Shortcode wrapper for the visit-request form.
 *
 * Registers [wrenchpress_visit_form]. The callback enqueues the form assets and
 * RETURNS the rendered markup string (never echoes), so the form embeds cleanly
 * inside any builder's shortcode surface (DIVI, Elementor) and both editors.
 *
 * @package WrenchPress
 */

defined( 'ABSPATH' ) || exit;

/**
 * Class WrenchPress_Shortcode
 */
class WrenchPress_Shortcode {

	/**
	 * Shortcode tag.
	 */
	const TAG = 'wrenchpress_visit_form';

	/**
	 * Register the shortcode.
	 *
	 * @return void
	 */
	public static function register() {
		add_shortcode( self::TAG, array( __CLASS__, 'render' ) );
	}

	/**
	 * Render the form for the shortcode.
	 *
	 * @param array|string $atts Shortcode attributes.
	 * @return string Form markup.
	 */
	public static function render( $atts ) {
		WrenchPress_Visit_Form::enqueue_assets();

		return WrenchPress_Visit_Form::render(
			array_merge( (array) $atts, array( 'source' => 'shortcode' ) )
		);
	}
}
