<?php

namespace MovieEngine\Admin\Monetization\Tabs;

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

class PaywallTab {

    public static function render($options = [], $standalone = true) {
        if (has_action('movie_engine_render_pro_paywall')) {
            do_action('movie_engine_render_pro_paywall', $options, $standalone);
            return;
        }
?>
        <?php if ($standalone) : ?>
            <div class="movie-engine-settings-section">
                <div class="movie-engine-section-header">
                    <h2><?php esc_html_e('Paywall & Premium Content', 'cine-movie-engine'); ?></h2>
                    <p class="description"><?php esc_html_e('Restrict content and manage premium memberships', 'cine-movie-engine'); ?></p>
                </div>
            <?php endif; ?>
            <div class="movie-engine-card">
                <div class="movie-engine-card-header">
                    <h3><span class="fa-solid fa-lock"></span> <?php esc_html_e('Paywall 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('Paywall System', 'cine-movie-engine'); ?></strong>
                            <p><?php esc_html_e('The Paywall & Premium content system 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 Paywall System', 'cine-movie-engine'); ?></span>
                            </label>
                            <p class="movie-engine-help-text"><?php esc_html_e('Restrict content to registered/premium users', 'cine-movie-engine'); ?></p>
                        </div>

                        <div class="movie-engine-form-group">
                            <label><?php esc_html_e('Content Restriction Mode', 'cine-movie-engine'); ?></label>
                            <select class="movie-engine-select" disabled>
                                <option selected><?php esc_html_e('All Content (Require Login)', 'cine-movie-engine'); ?></option>
                                <option><?php esc_html_e('Premium Only (Marked Content)', 'cine-movie-engine'); ?></option>
                                <option><?php esc_html_e('Partial Access (Trailers/Previews)', 'cine-movie-engine'); ?></option>
                            </select>
                            <p class="movie-engine-help-text"><?php esc_html_e('Choose how content is restricted', 'cine-movie-engine'); ?></p>
                        </div>

                        <div class="movie-engine-form-group">
                            <label><?php esc_html_e('Preview Duration (seconds)', 'cine-movie-engine'); ?></label>
                            <input type="number" class="movie-engine-input" disabled value="120">
                            <p class="movie-engine-help-text"><?php esc_html_e('Allow non-premium users to watch this many seconds before paywall (0 = no preview)', '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-star"></span> <?php esc_html_e('Membership Tiers', 'cine-movie-engine'); ?></h3>
                </div>
                <div class="movie-engine-card-body">
                    <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 Free Trial', 'cine-movie-engine'); ?></span>
                            </label>
                        </div>

                        <div class="movie-engine-form-group me-ml-30">
                            <label><?php esc_html_e('Trial Period (days)', 'cine-movie-engine'); ?></label>
                            <input type="number" class="movie-engine-input" disabled value="7">
                            <p class="movie-engine-help-text"><?php esc_html_e('Number of days new users get free access', '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-star"></span> <?php esc_html_e('Subscribe Settings', '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('Subscribe Button Text', 'cine-movie-engine'); ?></label>
                            <input type="text" class="movie-engine-input" disabled value="Subscribe">
                            <p class="movie-engine-help-text"><?php esc_html_e('Text displayed on the Subscribe button', 'cine-movie-engine'); ?></p>
                        </div>

                        <div class="movie-engine-form-group">
                            <label><?php esc_html_e('Subscribe Button URL', 'cine-movie-engine'); ?></label>
                            <input type="text" class="movie-engine-input" disabled placeholder="https://yoursite.com/pricing">
                            <p class="movie-engine-help-text"><?php esc_html_e('Link to your subscription/pricing page', 'cine-movie-engine'); ?></p>
                        </div>
                    </div>
                </div>
            </div>

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