<?php
/**
 * Template registration helpers for WP Mail Doctor.
 *
 * @package MailDoctor
 */

use MailDoctor\WPMD_Email_Templates;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Register custom post type and related tax/meta.
 *
 * @return void
 */
function mail_doctor_register_cpt_tax(): void {
	if ( class_exists( WPMD_Email_Templates::class ) ) {
		WPMD_Email_Templates::register_content_types();
	}
}

/**
 * Locate Woo template path via plugin overrides.
 *
 * @param string $template      Default template path.
 * @param string $template_name Requested template name.
 * @param string $template_path Template directory.
 * @return string
 */
function mail_doctor_locate_template( string $template, string $template_name, string $template_path ): string {
	if ( class_exists( WPMD_Email_Templates::class ) ) {
		return WPMD_Email_Templates::locate_template( $template, $template_name, $template_path );
	}

	return $template;
}

/**
 * Register the WP Mail Doctor → Email Templates admin menu.
 *
 * Implementation populated in admin UI bootstrap.
 *
 * @return void
 */
function mail_doctor_register_templates_menu(): void {
	if ( class_exists( \MailDoctor\WPMD_Email_Admin::class ) ) {
		\MailDoctor\WPMD_Email_Admin::register_menu();
	}
}
