<?php
/**
 * Content Featured Property Template
 * 
 * This template displays the content for individual featured property posts.
 * 
 * HOW TO OVERRIDE THIS TEMPLATE:
 * 1. Copy this file from: wp-content/plugins/havenlytics/templates/content-property-featured.php
 * 2. Paste it to your theme at: wp-content/themes/your-theme/havenlytics/content-property-featured.php
 * 3. Modify the copied file to customize the featured property page
 * 
 * @package     Havenlytics
 * @subpackage  Templates/
 * @since       2.0.0
 */
if (!defined('ABSPATH')) {
    exit;
}

// Prefix all variables with hvnly_ to avoid global namespace conflicts
$hvnly_property_id = get_the_ID();
$hvnly_price = hvnly_get_property_price();
$hvnly_meta = hvnly_get_property_meta();
?>

<article id="property-<?php the_ID(); ?>" <?php post_class('hvnly-property-item hvnly-featured-property'); ?>>
    <div class="hvnly-property-inner">

        <div class="hvnly-property-image">
            <a href="<?php the_permalink(); ?>" class="hvnly-property-link">
                <?php 
                // The function hvnly_get_property_image() should return escaped HTML
                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                echo hvnly_get_property_image($hvnly_property_id, 'large', [
                    'class' => 'hvnly-property-thumbnail',
                    'loading' => 'lazy'
                ]); 
                ?>
                <span class="hvnly-featured-badge"><?php echo esc_html__( 'Featured', 'havenlytics' ); ?></span>
            </a>
        </div>

        <div class="hvnly-property-content">
            <h3 class="hvnly-property-title">
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            </h3>

            <div class="hvnly-property-price">
                <?php echo wp_kses_post( $hvnly_price ); ?>
            </div>

            <div class="hvnly-property-meta">
                <?php if ($hvnly_meta['bedrooms']) : ?>
                    <span class="hvnly-meta-item hvnly-bedrooms">
                        <?php echo esc_html( $hvnly_meta['bedrooms'] ); ?> <?php echo esc_html__( 'Beds', 'havenlytics' ); ?>
                    </span>
                <?php endif; ?>

                <?php if ($hvnly_meta['bathrooms']) : ?>
                    <span class="hvnly-meta-item hvnly-bathrooms">
                        <?php echo esc_html( $hvnly_meta['bathrooms'] ); ?> <?php echo esc_html__( 'Baths', 'havenlytics' ); ?>
                    </span>
                <?php endif; ?>
            </div>
        </div>
    </div>
</article>