<?php

namespace Webnestors\Wsn\Snippets;

class ArchiveDisplayProductAttribute extends \Webnestors\Wsn\Snippet {
    public $product_attribute = "";

    public $attribute_position = "";

    public function is_pro() : bool {
        return true;
    }

    public function tab() : string {
        return "archive";
    }

    public function title() : string {
        return esc_html__( "Display A Specific Product Attribute", "enhancements-for-woocommerce" );
    }

    public function description() : string {
        return esc_html__( "Display a specific attribute value on the archive page", "enhancements-for-woocommerce" );
    }

    public function meta() : array {
        return [[
            "label"       => esc_html__( "Attribute", "enhancements-for-woocommerce" ),
            "description" => esc_html__( "The attribute slug.", "enhancements-for-woocommerce" ),
            "name"        => "product_attribute",
            "type"        => "text",
        ], [
            "label"         => esc_html__( "Attribute Position", "enhancements-for-woocommerce" ),
            "description"   => esc_html__( "The displayed value's position on the page.", "enhancements-for-woocommerce" ),
            "name"          => "attribute_position",
            "type"          => "select",
            "options"       => [
                "woocommerce_before_shop_loop_item_title",
                "woocommerce_shop_loop_item_title",
                "woocommerce_after_shop_loop_item_title",
                "woocommerce_after_shop_loop_item"
            ],
            "option_labels" => [
                "Before Product Image",
                "Before Product Title",
                "After Product Title",
                "Before Add to Cart Button"
            ],
        ]];
    }

    public function tooltip() : ?string {
        ob_start();
        ?>
        <h1><strong><?php 
        echo esc_html( $this->title() );
        ?></strong></h1>
        <h3>Description</h3>
        <p>The Display a Specific Product Attribute module allows you to showcase a particular product attribute directly on the WooCommerce archive pages. This feature provides customers with quick access to key product details—such as size, color, material, or any other custom attribute—without needing to click into the product page, enhancing the browsing experience and making it easier for shoppers to compare options at a glance.</p>
        <p>This module is especially useful for stores where product attributes are central to customer decision-making, such as apparel, electronics, or home goods, where attributes like "Size," "Material," or "Capacity" can help customers find the product that best meets their needs.</p>
        <h3>Settings</h3>
        <h4>Attribute</h4>
        <p>Copy and paste here the attribute slug</p>
        <h4>Attribute Position</h4>
        <p>Choose where you want to display the attribute</p>
        <h3>Appearance</h3>
        <p>You can use the "wn-attribute" class to customize the appearence</p>
        <?php 
        return ob_get_clean();
    }

    public function run() {
    }

    function wn_display_product_attribute() {
    }

}
