<?php
/**
 * Pro themes grid + activation redirect.
 *
 * @package real-estate-company
 */

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

function real_estate_company_get_pro_themes() {
	$image_uri = get_template_directory_uri() . '/assets/images/pro-theme/';

	return array(
		array(
			'title' => __( 'Auto Parts Shop WordPress Theme', 'real-estate-company' ),
			'image' => $image_uri . 'Auto-Parts-Shop-WordPress-Elementor-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/auto-parts-woocommerce-theme/',
		),
		array(
			'title' => __( 'Motors Auto Parts Custom Theme', 'real-estate-company' ),
			'image' => $image_uri . 'Motors-Auto-Parts-Custom-WooCommerce-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/auto-parts-custom-woocommerce-wordpress-theme/',
		),
		array(
			'title' => __( 'Auto Parts WooCommerce Theme', 'real-estate-company' ),
			'image' => $image_uri . 'Auto-Parts-WooCommerce-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/auto-parts-wordpress-theme/',
		),
		array(
			'title' => __( 'Nusa Business Consulting Theme', 'real-estate-company' ),
			'image' => $image_uri . 'Business-Consulting-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/nusa-business-consulting-wordpress-theme/',
		),
		array(
			'title' => __( 'Construction Building Theme', 'real-estate-company' ),
			'image' => $image_uri . 'Construction-Building-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/construction-and-building-wordpress-theme/',
		),
		array(
			'title' => __( 'Constructo Construction Theme', 'real-estate-company' ),
			'image' => $image_uri . 'Constructo-Construction-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/constructo-construction-wordpress-theme/',
		),
		array(
			'title' => __( 'Grocery Store WooCommerce Theme', 'real-estate-company' ),
			'image' => $image_uri . 'Grocery-Store-and-Organic-Food-WooCommerce-eCommerce-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/grocery-store-wordpress-theme/',
		),
		array(
			'title' => __( 'HotelBooking Resort Theme', 'real-estate-company' ),
			'image' => $image_uri . 'HotelBooking-Hotel-and-Resort-Booking-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/hotelbooking-hotel-and-resort-booking-wordpress-theme/',
		),
		array(
			'title' => __( 'Food Menu Ordering Plugin', 'real-estate-company' ),
			'image' => $image_uri . 'info-1.jpg',
			'url'   => 'https://www.templatehouse.net/plugins/food-menu-ordering-for-woocommerce/',
		),
		array(
			'title' => __( 'Soledad Personal Blog Theme', 'real-estate-company' ),
			'image' => $image_uri . 'Soledad-Optimized-Personal-Blog-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/soledad-optimized-personal-blog-wordpress-theme/',
		),
		array(
			'title' => __( 'SpaciaN Real Estate Theme', 'real-estate-company' ),
			'image' => $image_uri . 'SpaciaN-Real-Estate-Construction-Group-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/real-estate-and-construction-group-wordpress-theme/',
		),
		array(
			'title' => __( 'TimelineX AI Story Timeline Builder', 'real-estate-company' ),
			'image' => $image_uri . 'Timelinex-ai-Story-Timeline-Builder.jpg',
			'url'   => 'https://www.templatehouse.net/plugins/ai-story-timeline-builder-for-wordpress/',
		),
	);
}

function real_estate_company_render_pro_themes_section() {
	$pro_themes = real_estate_company_get_pro_themes();
	?>
	<div class="pro-themes-section">
		<h2 class="pro-themes-heading"><?php esc_html_e( 'Our Pro Themes & Plugins', 'real-estate-company' ); ?></h2>
		<p class="pro-themes-intro"><?php esc_html_e( 'Explore our premium WordPress themes and plugins. Click any screenshot to view full details on our website.', 'real-estate-company' ); ?></p>
		<div class="pro-themes-grid">
			<?php foreach ( $pro_themes as $pro_theme ) : ?>
				<a class="pro-theme-card" href="<?php echo esc_url( $pro_theme['url'] ); ?>" target="_blank" rel="noopener noreferrer">
					<span class="pro-theme-thumb">
						<img src="<?php echo esc_url( $pro_theme['image'] ); ?>" alt="<?php echo esc_attr( $pro_theme['title'] ); ?>" loading="lazy" />
					</span>
					<span class="pro-theme-title"><?php echo esc_html( $pro_theme['title'] ); ?></span>
				</a>
			<?php endforeach; ?>
		</div>
	</div>
	<?php
}

function real_estate_company_enqueue_pro_themes_assets( $hook ) {
	wp_enqueue_style(
		'real-estate-company-pro-themes',
		get_template_directory_uri() . '/assets/css/pro-themes.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);
}
add_action( 'admin_enqueue_scripts', 'real_estate_company_enqueue_pro_themes_assets' );
