<?php

namespace MovieEngine\Admin\Monetization\Tabs;

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

class AdBlockTab {

    public static function render($options = [], $standalone = true) {
        if (has_action('movie_engine_render_pro_adblock')) {
            do_action('movie_engine_render_pro_adblock', $options, $standalone);
            return;
        }
?>
        <?php if ($standalone) : ?>
            <div class="movie-engine-settings-section">
                <div class="movie-engine-section-header">
                    <h2><?php esc_html_e('Ad Block Detector', 'cine-movie-engine'); ?></h2>
                    <p class="description"><?php esc_html_e('Detect and handle users with ad blockers to protect your revenue.', 'cine-movie-engine'); ?></p>
                </div>
            <?php endif; ?>
            <div class="movie-engine-card">
                <div class="movie-engine-card-header">
                    <h3><span class="fa-solid fa-shield-halved"></span> <?php esc_html_e('Detector Settings', 'cine-movie-engine'); ?></h3>
                </div>
                <div class="movie-engine-card-body">
                    <div class="me-pro-notice-box">
                        <span class="dashicons dashicons-lock"></span>
                        <div class="me-pro-notice-message">
                            <strong><?php esc_html_e('Ad Block Detector', 'cine-movie-engine'); ?></strong>
                            <p><?php esc_html_e('The Ad Block Detector is a PRO feature. Upgrade to unlock.', 'cine-movie-engine'); ?></p>
                        </div>
                        <a href="<?php echo esc_url(\MovieEngine\Admin\Upgrade::get_pro_url('pricing')); ?>" target="_blank" class="button button-primary me-pro-notice-btn">
                            <?php esc_html_e('Upgrade to Pro', 'cine-movie-engine'); ?>
                        </a>
                    </div>

                    <div class="me-locked-feature">
                        <div class="movie-engine-form-group">
                            <label class="movie-engine-checkbox-label">
                                <input type="checkbox" disabled checked>
                                <span class="movie-engine-checkbox-text"><?php esc_html_e('Enable Ad Block Detector', 'cine-movie-engine'); ?></span>
                            </label>
                        </div>

                        <div class="movie-engine-form-group">
                            <label class="movie-engine-checkbox-label">
                                <input type="checkbox" disabled>
                                <span class="movie-engine-checkbox-text"><?php esc_html_e('Strict Mode (Block Player)', 'cine-movie-engine'); ?></span>
                            </label>
                            <p class="movie-engine-help-text"><?php esc_html_e('If enabled, the video player will be hidden until the user disables AdBlock.', 'cine-movie-engine'); ?></p>
                        </div>

                        <div class="movie-engine-form-group">
                            <label class="movie-engine-checkbox-label">
                                <input type="checkbox" disabled>
                                <span class="movie-engine-checkbox-text"><?php esc_html_e('Test Mode (Force Warning)', 'cine-movie-engine'); ?></span>
                            </label>
                            <p class="movie-engine-help-text"><?php esc_html_e('Force the warning to show for testing purposes (even if no ad blocker is detected).', 'cine-movie-engine'); ?></p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="movie-engine-card">
                <div class="movie-engine-card-header">
                    <h3><span class="fa-solid fa-comment"></span> <?php esc_html_e('Warning Message', 'cine-movie-engine'); ?></h3>
                </div>
                <div class="movie-engine-card-body">
                    <div class="me-locked-feature">
                        <div class="movie-engine-form-group">
                            <label><?php esc_html_e('Warning Title', 'cine-movie-engine'); ?></label>
                            <input type="text" class="movie-engine-input" disabled value="Ad Blocker Detected">
                        </div>

                        <div class="movie-engine-form-group">
                            <label><?php esc_html_e('Warning Message', 'cine-movie-engine'); ?></label>
                            <textarea class="movie-engine-textarea" rows="3" disabled><?php esc_html_e('Please disable your ad blocker to continue watching. We rely on ads to keep our content free.', 'cine-movie-engine'); ?></textarea>
                        </div>

                        <div class="movie-engine-form-group">
                            <label><?php esc_html_e('Button Text', 'cine-movie-engine'); ?></label>
                            <input type="text" class="movie-engine-input" disabled value="I have disabled AdBlock">
                        </div>
                    </div>
                </div>
            </div>

            <?php if ($standalone) : ?>
            </div>
        <?php endif; ?>
<?php
    }
}
