<?php
/**
 * GhostTrigger — a trigger that never fires but appears in the editor
 * showing a "Pro" badge and upgrade prompt.
 *
 * Inspired by ShopMagic's ImitationCommonEvent pattern.
 *
 * @package CartCue
 */

namespace CartCue\Triggers;

defined( 'ABSPATH' ) || exit;

abstract class GhostTrigger extends AbstractTrigger {

	/** This trigger never fires. */
	public function register_hooks(): void {}

	/** Ghost triggers are always marked as Pro. */
	public function is_pro(): bool {
		return true;
	}

	/**
	 * Returns upgrade CTA HTML rendered inside the trigger settings panel
	 * when this trigger is selected in the editor.
	 */
	public function get_upgrade_html(): string {
		return sprintf(
			'<div class="ap-pro-gate">'
			. '<div class="ap-pro-gate__icon"><i class="ti ti-lock" aria-hidden="true"></i></div>'
			. '<div class="ap-pro-gate__title">%s</div>'
			. '<p class="ap-pro-gate__desc">%s</p>'
			. '<a href="' . esc_url( \CartCue\Plugin::upgrade_url( 'ghost_trigger_' . $this->get_slug() ) ) . '" target="_blank" class="ap-btn ap-btn-primary">%s →</a>'
			. '</div>',
			esc_html(
				sprintf(
					/* translators: %s: trigger label */
					__( 'Pro Feature: %s', 'cartcue-sales-automation' ),
					$this->get_label()
				)
			),
			esc_html( $this->get_pro_description() ),
			esc_html__( 'Upgrade to CartCue Pro', 'cartcue-sales-automation' )
		);
	}

	/** Description shown inside the upgrade gate. */
	abstract protected function get_pro_description(): string;
}
