<?php
namespace FuseCommerce\Views\Admin\Settings;
if ( ! defined( 'ABSPATH' ) ) exit;

use FuseCommerce\Views\Admin\Settings\BaseView;
use FuseCommerce\Views\Admin\Settings\IView;
use FuseCommerce\Helpers\FilterConfigHelper;
use FuseCommerce\Utils\OptionUtils;

class Shortcodes extends BaseView implements IView {

    public function render(): void {
        ?>
        <div class="row">
            <div class="col-md-12 mb-3">
                <h5><?php esc_html_e('Available shortcodes.', 'ftlcommerce-instant-product-search'); ?></h5>
            </div>
            <div class="col-md-12">
                <h6 style="background: #F2F2F2;"><?php echo esc_html('[ftlcommerce]') ?></h6>
                <h6 style="background: #F2F2F2;"><?php echo esc_html('[ftlcommerce initial_products_load_no="12" load_more_products_no="12" tag_limit="6" category_limit ="5" free_search_debounce_delay="1000" fuse_threshold="0.4" fuse_name_weight="3" fuse_short_description_weight="1.5"]') ?></h6>
                <div class="alert alert-info mt-4">
                    <div><?php esc_html_e('The [ftlcommerce] shortcode displays your product catalog with filters and search functionality. You can customize how it behaves by adding attributes to the shortcode.', 'ftlcommerce-instant-product-search'); ?></div>
                    <div class="mt-2">
                        <h6><?php esc_html_e('All Available Attributes:', 'ftlcommerce-instant-product-search'); ?></h6>
                        <ol>
                            <li><strong><?php esc_html_e('tag_limit', 'ftlcommerce-instant-product-search'); ?></strong> <?php esc_html_e('What it does: Controls how many product tags are visible when the page loads. Why it matters: If you have 50 tags but only show 10 initially, your filter section stays clean and organized. Users can click "Show All Tags" if they need to see more.', 'ftlcommerce-instant-product-search'); ?></li>
                            <li><strong><?php esc_html_e('category_limit', 'ftlcommerce-instant-product-search'); ?></strong> <?php esc_html_e('What it does: Controls how many parent (top-level) categories are visible when the page loads. Why it matters: Similar to tags, this keeps your category filter organized.', 'ftlcommerce-instant-product-search'); ?></li>
                            <li><strong><?php esc_html_e('free_search_debounce_delay', 'ftlcommerce-instant-product-search'); ?></strong> <?php esc_html_e('What it does: Sets how long to wait (in milliseconds) after someone stops typing before running the search. Why it matters: Without this delay, search would run on every single keystroke as users type "blue shirt". That\'s wasteful and can slow things down.', 'ftlcommerce-instant-product-search'); ?></li>
                            <li>
                                <strong><?php esc_html_e('fuse_threshold', 'ftlcommerce-instant-product-search'); ?></strong> <?php esc_html_e('What it does: Controls how "fuzzy" or forgiving your search is. Why it matters: Should "blu shrt" find "blue shirt"? Should "nike shoes" find "Nike Running Shoes"? This setting controls that. Default: 0.3 (moderately forgiving). ', 'ftlcommerce-instant-product-search'); ?>
                                <ol>
                                    <li><?php esc_html_e('0.0 = Only exact matches (very strict)', 'ftlcommerce-instant-product-search'); ?></li>
                                    <li><?php esc_html_e('0.1-0.2 = Close matches only, minimal typos allowed', 'ftlcommerce-instant-product-search'); ?></li>
                                    <li><?php esc_html_e('0.3 = Balanced - some typos and variations OK (default)', 'ftlcommerce-instant-product-search'); ?></li>
                                    <li><?php esc_html_e('0.4-0.5 = Very forgiving - lots of variation allowed', 'ftlcommerce-instant-product-search'); ?></li>
                                    <li><?php esc_html_e('0.6+ = Too fuzzy - matches too much (not recommended)', 'ftlcommerce-instant-product-search'); ?></li>
                                    <li><?php esc_html_e('1.0 = Matches everything (don\'t use this!)', 'ftlcommerce-instant-product-search'); ?></li>
                                </ol>
                            </li>
                            <li><strong><?php esc_html_e('fuse_name_weight', 'ftlcommerce-instant-product-search'); ?></strong> <?php esc_html_e('What it does: Determines how important the product NAME is when ranking search results. Why it matters: When someone searches "blue shoes", should products with "blue" in the NAME appear first, or should products with "blue" in the DESCRIPTION rank equally? Default: 2 (twice as important as short_description).', 'ftlcommerce-instant-product-search'); ?></li>
                            <li><strong><?php esc_html_e('fuse_short_description_weight', 'ftlcommerce-instant-product-search'); ?></strong> <?php esc_html_e('What it does: Determines how important the short DESCRIPTION is when ranking search results. Why it matters: Works together with fuse_name_weight to control what products appear first in search results. Default: 1 (baseline importance).', 'ftlcommerce-instant-product-search'); ?></li>
                            <li><strong><?php esc_html_e('initial_products_load_no', 'ftlcommerce-instant-product-search'); ?></strong> <?php esc_html_e('What it does: Controls how many products are displayed when the page first loads. Why it matters: If you have 100 products, showing all of them at once can slow down the page and overwhelm visitors. By showing 12 initially (for example) with a "Load More" button, your page loads faster and users can browse incrementally. Default: 12 products.', 'ftlcommerce-instant-product-search'); ?></li>
                            <li><strong><?php esc_html_e('load_more_products_no', 'ftlcommerce-instant-product-search'); ?></strong> <?php esc_html_e('What it does: Controls how many additional products appear when someone clicks the "Load More" button. Why it matters: This balances convenience with performance. Loading 12 more products at a time is usually a good middle ground. Default: 12 products.', 'ftlcommerce-instant-product-search'); ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
        <?php
    }
}