<?php

namespace SugarCalendarBookings\Support\Shortcodes;

/**
 * Abstract Shortcode.
 *
 * Base class for all shortcodes in the plugin.
 *
 * Shortcodes can appear in various contexts including post content, widgets,
 * theme templates, and page builders. This base class provides a consistent
 * structure for implementing shortcodes across the plugin.
 *
 * @since 1.0.0
 */
abstract class AbstractShortcode {

	/**
	 * Register the shortcode.
	 *
	 * @since 1.0.0
	 */
	public function register(): void {

		add_shortcode( $this->get_shortcode_name(), [ $this, 'display' ] );
	}

	/**
	 * Display the shortcode output.
	 *
	 * @since 1.0.0
	 *
	 * @param array  $attributes Shortcode attributes.
	 * @param string $content    Shortcode content.
	 * @param string $tag        Shortcode tag.
	 *
	 * @return string Shortcode HTML output.
	 */
	abstract public function display( array $attributes, string $content, string $tag ): string;

	/**
	 * Get the shortcode name (tag).
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	abstract public function get_shortcode_name(): string;
}
