<?php

namespace Webnestors\Wsn\Snippets;

class ArchiveSalesEndsIn extends \Webnestors\Wsn\Snippet {
    public $sales_ends = "";

    public $sales_ends_position = "";

    public $sales_ended = "";

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

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

    public function title() : string {
        return esc_html__( "Sales Ends timer", "enhancements-for-woocommerce" );
    }

    public function description() : string {
        return esc_html__( "Show a sales ends timer in archive pages", "enhancements-for-woocommerce" );
    }

    public function meta() : array {
        return [[
            "label"       => esc_html__( "Displayed Text", "enhancements-for-woocommerce" ),
            "description" => esc_html__( "For Example (Sales end in)", "enhancements-for-woocommerce" ),
            "name"        => "sales_ends",
            "type"        => "text",
        ], [
            "label"       => esc_html__( "Sales Ended Text", "enhancements-for-woocommerce" ),
            "description" => esc_html__( "For Example (Sales has ended)", "enhancements-for-woocommerce" ),
            "name"        => "sales_ended",
            "type"        => "text",
        ], [
            "label"         => esc_html__( "Timer Position", "enhancements-for-woocommerce" ),
            "description"   => esc_html__( "The timer's position on the page.", "enhancements-for-woocommerce" ),
            "name"          => "sales_ends_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 Sales Ends Timer module displays a countdown timer on WooCommerce archive pages for products with active discounts, indicating the time remaining until the sale ends. This feature creates urgency and encourages customers to act quickly to secure a discount before it expires. Seeing a live timer reinforces the limited-time nature of the promotion, helping increase conversions and encouraging shoppers to add items to their cart faster.</p>
        <p>Ideal for stores that frequently run time-sensitive promotions, this module is designed to drive sales by emphasizing urgency, especially during peak shopping seasons or flash sales.</p>
        <h3>Settings</h3>
        <h4>Displayed Text</h4>
        <p>Write here the desired text to be displayed For Example (Sales end in)</p>
        <h4>Sales Ended Text</h4>
        <p>The text that will appear after the sale has ended For Example (Sales has ended)</p>
        <h4>Timer Position</h4>
        <p>Choose where the timer will be displayed on the product archive page</p>
        <h3>Appearance</h3>
        <p>You can use the "wn-timer" class to customize the appearence</p>
        <?php 
        return ob_get_clean();
    }

    public function run() {
    }

    function wn_show_countdown_timer_on_loop() {
    }

}
