<?php

namespace MovieEngine\Admin;

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

class SettingsSidebar {

    public static function render($active_tab, $page_slug) {
?>
        <div class="movie-engine-settings-sidebar">
            <nav class="movie-engine-settings-nav">
                <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=dashboard"
                    class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'dashboard' ? 'active' : ''); ?>">
                    <span class="dashicons dashicons-dashboard"></span>
                    <span class="movie-engine-nav-label"><?php esc_html_e('Dashboard', 'cine-movie-engine'); ?></span>
                </a>
                <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=general"
                    class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'general' ? 'active' : ''); ?>">
                    <span class="dashicons dashicons-admin-settings"></span>
                    <span class="movie-engine-nav-label"><?php esc_html_e('General', 'cine-movie-engine'); ?></span>
                </a>
                <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=user_settings"
                    class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'user_settings' ? 'active' : ''); ?>">
                    <span class="dashicons dashicons-admin-users"></span>
                    <span class="movie-engine-nav-label"><?php esc_html_e('User Settings', 'cine-movie-engine'); ?></span>
                </a>
                <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=social_login"
                    class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'social_login' ? 'active' : ''); ?>">
                    <span class="dashicons dashicons-share"></span>
                    <span class="movie-engine-nav-label">
                        <?php esc_html_e('Social Login', 'cine-movie-engine'); ?>
                        <?php if (! apply_filters('movie_engine_enable_social_login', false)) : ?>
                            <span class="me-pro-badge">PRO</span>
                        <?php endif; ?>
                    </span>
                </a>

                <?php $is_design_active = strpos($active_tab, 'design') === 0; ?>
                <div class="movie-engine-nav-dropdown <?php echo esc_attr($is_design_active ? 'open' : ''); ?>">
                    <div class="movie-engine-nav-dropdown-toggle">
                        <span class="dashicons dashicons-art"></span>
                        <span class="movie-engine-nav-label"><?php esc_html_e('Appearance', 'cine-movie-engine'); ?></span>
                        <span class="dashicons dashicons-arrow-down-alt2 me-arrow"></span>
                    </div>

                    <div class="movie-engine-nav-dropdown-menu <?php echo esc_attr($is_design_active ? 'me-show' : ''); ?>">
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=design_general"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'design_general' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('General', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=design_pages"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'design_pages' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Page Settings', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=design_movie"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'design_movie' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Single Movie', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=design_series"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'design_series' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Single Series', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=design_episode"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'design_episode' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Single Episode', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=design_archive"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'design_archive' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Archive/Listing', 'cine-movie-engine'); ?></span>
                        </a>
                    </div>
                </div>

                <?php $is_monetization_active = strpos($active_tab, 'monetization') === 0; ?>
                <div class="movie-engine-nav-dropdown <?php echo esc_attr($is_monetization_active ? 'open' : ''); ?>">
                    <div class="movie-engine-nav-dropdown-toggle">
                        <span class="dashicons dashicons-money-alt"></span>
                        <span class="movie-engine-nav-label"><?php esc_html_e('Monetization', 'cine-movie-engine'); ?></span>
                        <span class="dashicons dashicons-arrow-down-alt2 me-arrow"></span>
                    </div>

                    <div class="movie-engine-nav-dropdown-menu <?php echo esc_attr($is_monetization_active ? 'me-show' : ''); ?>">
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=monetization_general"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'monetization_general' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('General Ads', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=monetization_slots"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'monetization_slots' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Ad Slots', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=monetization_video"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'monetization_video' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label">
                                <?php esc_html_e('Video Ads', 'cine-movie-engine'); ?>
                                <?php if (! apply_filters('movie_engine_is_pro', false)) : ?>
                                    <span class="me-pro-badge">PRO</span>
                                <?php endif; ?>
                            </span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=monetization_paywall"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'monetization_paywall' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label">
                                <?php esc_html_e('Paywall & Premium', 'cine-movie-engine'); ?>
                                <?php if (! apply_filters('movie_engine_is_pro', false)) : ?>
                                    <span class="me-pro-badge">PRO</span>
                                <?php endif; ?>
                            </span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=monetization_plans"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'monetization_plans' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label">
                                <?php esc_html_e('Membership Plans', 'cine-movie-engine'); ?>
                                <?php if (! apply_filters('movie_engine_is_pro', false)) : ?>
                                    <span class="me-pro-badge">PRO</span>
                                <?php endif; ?>
                            </span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=monetization_affiliate"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'monetization_affiliate' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Affiliates', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=monetization_adblock"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'monetization_adblock' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label">
                                <?php esc_html_e('Ad Block Detector', 'cine-movie-engine'); ?>
                                <?php if (! apply_filters('movie_engine_is_pro', false)) : ?>
                                    <span class="me-pro-badge">PRO</span>
                                <?php endif; ?>
                            </span>
                        </a>
                    </div>
                </div>

                <?php $is_payments_active = strpos($active_tab, 'payments') === 0; ?>
                <div class="movie-engine-nav-dropdown <?php echo esc_attr($is_payments_active ? 'open' : ''); ?>">
                    <div class="movie-engine-nav-dropdown-toggle">
                        <span class="dashicons dashicons-cart"></span>
                        <span class="movie-engine-nav-label">
                            <?php esc_html_e('Payments', 'cine-movie-engine'); ?>
                            <?php if (! apply_filters('movie_engine_is_pro', false)) : ?>
                                <span class="me-pro-badge">PRO</span>
                            <?php endif; ?>
                        </span>
                        <span class="dashicons dashicons-arrow-down-alt2 me-arrow"></span>
                    </div>

                    <div class="movie-engine-nav-dropdown-menu <?php echo esc_attr($is_payments_active ? 'me-show' : ''); ?>">
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=payments_general"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'payments_general' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('General', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=payments_transactions"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'payments_transactions' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Transactions', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=payments_methods"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'payments_methods' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Payment Methods', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=payments_subscriptions"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'payments_subscriptions' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Subscriptions', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=payments_coupons"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'payments_coupons' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Coupons', 'cine-movie-engine'); ?></span>
                        </a>
                    </div>
                </div>

                <?php $is_player_active = strpos($active_tab, 'player') === 0; ?>
                <div class="movie-engine-nav-dropdown <?php echo esc_attr($is_player_active ? 'open' : ''); ?>">
                    <div class="movie-engine-nav-dropdown-toggle">
                        <span class="dashicons dashicons-controls-play"></span>
                        <span class="movie-engine-nav-label"><?php esc_html_e('Player', 'cine-movie-engine'); ?></span>
                        <span class="dashicons dashicons-arrow-down-alt2 me-arrow"></span>
                    </div>

                    <div class="movie-engine-nav-dropdown-menu <?php echo esc_attr($is_player_active ? 'me-show' : ''); ?>">
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=player_general"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'player_general' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('General', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=player_sources"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'player_sources' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Sources & Quality', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=player_subtitles"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'player_subtitles' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Subtitles', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=player_audio"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'player_audio' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Audio', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=player_series"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'player_series' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Series', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=player_ui"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'player_ui' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('UI & Theme', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=player_performance"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'player_performance' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Performance', 'cine-movie-engine'); ?></span>
                        </a>
                        <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=player_security"
                            class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'player_security' ? 'active' : ''); ?>">
                            <span class="movie-engine-nav-dot"></span>
                            <span class="movie-engine-nav-label"><?php esc_html_e('Security', 'cine-movie-engine'); ?></span>
                        </a>
                    </div>
                </div>
                <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=emails_general"
                    class="movie-engine-nav-item <?php echo strpos($active_tab, 'emails') === 0 ? 'active' : ''; ?>">
                    <span class="dashicons dashicons-email-alt"></span>
                    <span class="movie-engine-nav-label"><?php esc_html_e('Email Settings', 'cine-movie-engine'); ?></span>
                </a>
                <a href="?page=<?php echo esc_attr($page_slug); ?>&tab=api"
                    class="movie-engine-nav-item <?php echo esc_attr($active_tab === 'api' ? 'active' : ''); ?>">
                    <span class="dashicons dashicons-cloud"></span>
                    <span class="movie-engine-nav-label"><?php esc_html_e('API Settings', 'cine-movie-engine'); ?></span>
                </a>
            </nav>
        </div>
<?php
    }
}
