<?php

namespace Webnestors\Wsn\Snippets;

class CheckoutFraudProtection extends \Webnestors\Wsn\Snippet {
    public $fraud_message = "Your email address has been flagged";

    public $fraud_emails = "spam@spam-mail.com";

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

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

    public function title() : string {
        return __( "Fraud Protection", "enhancements-for-woocommerce" );
    }

    public function description() : string {
        return __( "Enabling this you will be able to place 1 or more emails that you want to prevent placing orders on your site, this also empty the cart automatically", "enhancements-for-woocommerce" );
    }

    public function meta() : array {
        return [[
            "label"       => __( "Emails", "enhancements-for-woocommerce" ),
            "description" => __( "Emails separated with commas", "enhancements-for-woocommerce" ),
            "name"        => "fraud_emails",
            "type"        => "text",
        ], [
            "label"       => __( "Your Message", "enhancements-for-woocommerce" ),
            "description" => __( "The message that the client will see", "enhancements-for-woocommerce" ),
            "name"        => "fraud_message",
            "type"        => "text",
        ]];
    }

    public function tooltip() : ?string {
        ob_start();
        ?>
        <h1><strong><?php 
        echo esc_html( $this->title() );
        ?></strong></h1>
        <h3>Description</h3>
        <p>The Fraud Protection module enhances your store's security by allowing you to block specific email addresses from placing orders on your WooCommerce site. By entering one or more emails in the settings, you can prevent orders from suspicious or previously identified fraudulent accounts. Additionally, this feature will automatically empty the cart if a blocked email address attempts to proceed through the checkout process, creating a seamless deterrent against unwanted transactions.</p>
        <p>This module is invaluable for store owners aiming to protect their business from fraudulent orders, reduce chargebacks, and ensure legitimate customers have a smooth and secure shopping experience.</p>
        <h3>Settings</h3>
        <h4>Emails</h4>
        <p>Place the emails that you want to prevent buying from your store seperated by commas</p>
        <h4>Your Message</h4>
        <p>The message that the client will see on the checkout</p>
        <h3>Appearance</h3>
        <p>You can use the class "ul.woocommerce-error" for customizing the appearence</p>
        <?php 
        return ob_get_clean();
    }

    public function run() {
    }

    function wn_validate_checkout_email_address( $fields, $errors ) {
    }

}
