<?php
/**
 * Overview page for the WPResidence Translate admin menu.
 *
 * This file renders a high-level explanation of how translations are stored
 * and managed in the plugin, so administrators have a quick reference.
 *
 * @package WPR_Translate
 */

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

/**
 * Render the overview page.
 *
 * @return void
 */
function wpr_translate_admin_render_overview_page() {
    // Build reusable admin URLs used by the quick setup actions.
    $languages_url             = esc_url( admin_url( 'admin.php?page=wpr-translate-languages' ) );
    $strings_url               = esc_url( admin_url( 'admin.php?page=wpr-translate-strings' ) );
    $taxonomies_url            = esc_url( admin_url( 'admin.php?page=wpr-translate-taxonomies' ) );
    $custom_fields_url         = esc_url( admin_url( 'admin.php?page=wpr-translate-custom-fields' ) );
    $automatic_translation_url = esc_url( admin_url( 'admin.php?page=wpr-translate-automatic-translation' ) );
    $settings_url              = esc_url( admin_url( 'admin.php?page=wpr-translate-settings' ) );
    $menus_url                 = esc_url( admin_url( 'nav-menus.php' ) );
    $menu_sync_url             = esc_url( admin_url( 'admin.php?page=wpr-translate-menu-sync' ) );
    $theme_options_url         = esc_url( admin_url( 'admin.php?page=wpresidence_admin' ) );
    $header_icon_url           = esc_url( WPR_TRANSLATE_PLUGIN_URL . 'assets/img/1.svg' );
    $step_icon_1_url           = esc_url( WPR_TRANSLATE_PLUGIN_URL . 'assets/img/2.svg' );
    $step_icon_2_url           = esc_url( WPR_TRANSLATE_PLUGIN_URL . 'assets/img/3.svg' );
    $step_icon_3_url           = esc_url( WPR_TRANSLATE_PLUGIN_URL . 'assets/img/4.svg' );
    $step_icon_4_url           = esc_url( WPR_TRANSLATE_PLUGIN_URL . 'assets/img/5.svg' );
    $step_icon_5_url           = esc_url( WPR_TRANSLATE_PLUGIN_URL . 'assets/img/6.svg' );
    $step_icon_6_url           = esc_url( WPR_TRANSLATE_PLUGIN_URL . 'assets/img/7.svg' );
    $step_icon_7_url           = esc_url( WPR_TRANSLATE_PLUGIN_URL . 'assets/img/8.svg' );

    // Output the overview layout and quick links.
    ?>
    <div class="wrap wpr-translate-admin">
        <h1><?php esc_html_e( 'Start Here', 'wpr-translate' ); ?></h1>
        <div class="wpr-card wpr-overview-steps">
            <div class="wpr-overview-steps-header">
                <div class="wpr-overview-steps-header-icon">
                    <img src="<?php echo esc_url( $header_icon_url ); ?>" alt="" />
                </div>
                <div class="wpr-overview-steps-header-content">
                    <div class="wpr-overview-steps-title"><?php esc_html_e( 'Quick Setup Steps', 'wpr-translate' ); ?></div>
                    <div class="wpr-overview-steps-subtitle"><?php esc_html_e( 'Follow these steps to set up your site for multilingual support.', 'wpr-translate' ); ?></div>
                </div>
            </div>
            <div class="wpr-overview-steps-list">
                <div class="wpr-overview-step">
                    <div class="wpr-overview-step-main">
                        <div class="wpr-overview-step-icon">
                            <img src="<?php echo esc_url( $step_icon_1_url ); ?>" alt="" />
                        </div>
                        <div class="wpr-overview-step-content">
                            <div class="wpr-overview-step-text">
                                <strong><?php esc_html_e( 'Choose a starting language,', 'wpr-translate' ); ?></strong>
                                <?php esc_html_e( ' set the default language, and decide which languages are visible.', 'wpr-translate' ); ?>
                            </div>
                            <div class="wpr-overview-step-links">
                                <a class="wpr-overview-step-action" href="<?php echo esc_url( $languages_url ); ?>"><?php esc_html_e( 'Open Languages', 'wpr-translate' ); ?></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="wpr-overview-step">
                    <div class="wpr-overview-step-main">
                        <div class="wpr-overview-step-icon">
                            <img src="<?php echo esc_url( $step_icon_2_url ); ?>" alt="" />
                        </div>
                        <div class="wpr-overview-step-content">
                            <div class="wpr-overview-step-text">
                                <strong><?php esc_html_e( 'Enable String Translation', 'wpr-translate' ); ?></strong>
                                <?php esc_html_e( ' and scan themes and plugins strings, then generate MO files so WordPress can load them.', 'wpr-translate' ); ?>
                            </div>
                            <div class="wpr-overview-step-links">
                                <a class="wpr-overview-step-action" href="<?php echo esc_url( $strings_url ); ?>"><?php esc_html_e( 'Open Theme & Plugin Strings', 'wpr-translate' ); ?></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="wpr-overview-step">
                    <div class="wpr-overview-step-main">
                        <div class="wpr-overview-step-icon">
                            <img src="<?php echo esc_url( $step_icon_3_url ); ?>" alt="" />
                        </div>
                        <div class="wpr-overview-step-content">
                            <div class="wpr-overview-step-text">
                                <strong><?php esc_html_e( 'Scan taxonomies', 'wpr-translate' ); ?></strong>
                                <?php esc_html_e( ' and enable automatic translation rules.', 'wpr-translate' ); ?>
                            </div>
                            <div class="wpr-overview-step-links">
                                <a class="wpr-overview-step-action" href="<?php echo esc_url( $taxonomies_url ); ?>"><?php esc_html_e( 'Open Taxonomy Translation', 'wpr-translate' ); ?></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="wpr-overview-step">
                    <div class="wpr-overview-step-main">
                        <div class="wpr-overview-step-icon">
                            <img src="<?php echo esc_url( $step_icon_4_url ); ?>" alt="" />
                        </div>
                        <div class="wpr-overview-step-content">
                            <div class="wpr-overview-step-text">
                                <strong><?php esc_html_e( 'Create and translate property ad layout', 'wpr-translate' ); ?></strong>
                                <?php esc_html_e( ' and labels.', 'wpr-translate' ); ?>
                            </div>
                            <div class="wpr-overview-step-links">
                                <a class="wpr-overview-step-action" href="<?php echo esc_url( $custom_fields_url ); ?>"><?php esc_html_e( 'Open Custom Field Rules', 'wpr-translate' ); ?></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="wpr-overview-step">
                    <div class="wpr-overview-step-main">
                        <div class="wpr-overview-step-icon">
                            <img src="<?php echo esc_url( $step_icon_5_url ); ?>" alt="" />
                        </div>
                        <div class="wpr-overview-step-content">
                            <div class="wpr-overview-step-text">
                                <strong><?php esc_html_e( 'Set up AI automatic translation.', 'wpr-translate' ); ?></strong>
                                <?php esc_html_e( ' Add the OpenAI API key in your settings if you want post content translated.', 'wpr-translate' ); ?>
                            </div>
                            <div class="wpr-overview-step-links">
                                <a class="wpr-overview-step-action" href="<?php echo esc_url( $automatic_translation_url ); ?>"><?php esc_html_e( 'Open Automatic Translation', 'wpr-translate' ); ?></a>
                                <a class="wpr-overview-step-action" href="<?php echo esc_url( $settings_url ); ?>"><?php esc_html_e( 'Open Settings', 'wpr-translate' ); ?></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="wpr-overview-step">
                    <div class="wpr-overview-step-main">
                        <div class="wpr-overview-step-icon">
                            <img src="<?php echo esc_url( $step_icon_6_url ); ?>" alt="" />
                        </div>
                        <div class="wpr-overview-step-content">
                            <div class="wpr-overview-step-text">
                                <strong><?php esc_html_e( 'Create menus,', 'wpr-translate' ); ?></strong>
                                <?php esc_html_e( ' define pages, add language switcher to your header, and synchronize menus when needed.', 'wpr-translate' ); ?>
                            </div>
                            <div class="wpr-overview-step-links">
                                <a class="wpr-overview-step-action" href="<?php echo esc_url( $menus_url ); ?>"><?php esc_html_e( 'Open Menus', 'wpr-translate' ); ?></a>
                                <a class="wpr-overview-step-action" href="<?php echo esc_url( $menu_sync_url ); ?>"><?php esc_html_e( 'Open Menu Synchronization', 'wpr-translate' ); ?></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="wpr-overview-step">
                    <div class="wpr-overview-step-main">
                        <div class="wpr-overview-step-icon">
                            <img src="<?php echo esc_url( $step_icon_7_url ); ?>" alt="" />
                        </div>
                        <div class="wpr-overview-step-content">
                            <div class="wpr-overview-step-text">
                                <?php esc_html_e( 'Use the Auto Translate button in the post sidebar to translate each post individually.', 'wpr-translate' ); ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php
}
