<?php

namespace Webnestors\Wsn\Snippets;

class CheckoutReorderFields extends \Webnestors\Wsn\Snippet {
    public $billing_first_name = "10";

    public $billing_last_name = "20";

    public $billing_company = "30";

    public $billing_address_1 = "40";

    public $billing_address_2 = "50";

    public $billing_city = "60";

    public $billing_postcode = "70";

    public $billing_country = "80";

    public $billing_state = "90";

    public $billing_phone = "110";

    public $shipping_first_name = "10";

    public $shipping_last_name = "20";

    public $shipping_company = "30";

    public $shipping_address_1 = "40";

    public $shipping_address_2 = "50";

    public $shipping_city = "60";

    public $shipping_postcode = "70";

    public $shipping_country = "80";

    public $shipping_state = "90";

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

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

    public function title() : string {
        return __( "Reorder Checkout Fields", "enhancements-for-woocommerce" );
    }

    public function description() : string {
        return __( "Reorder the billing and shipping fields. Use a number as priority so that fields with lower have higher priority.", "enhancements-for-woocommerce" );
    }

    public function meta() : array {
        return [
            [
                "label"       => __( "Billing First Name", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_first_name",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing Last Name", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_last_name",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing Company", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_company",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing Address 1", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_address_1",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing Address 2", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_address_2",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing City", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_city",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing Postal Code", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_postcode",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing Country", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_country",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing State", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_state",
                "type"        => "text",
            ],
            [
                "label"       => __( "Billing Phone", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "billing_phone",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping First Name", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_first_name",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping Last Name", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_last_name",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping Company", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_company",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping Address 1", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_address_1",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping Address 2", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_address_2",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping City", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_city",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping Postal Code", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_postcode",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping Country", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_country",
                "type"        => "text",
            ],
            [
                "label"       => __( "Shipping State", "enhancements-for-woocommerce" ),
                "description" => __( "Set Priority Number. Lower number means higher priority.", "enhancements-for-woocommerce" ),
                "name"        => "shipping_state",
                "type"        => "text",
            ]
        ];
    }

    public function tooltip() : ?string {
        ob_start();
        ?>
        <h1><strong><?php 
        echo esc_html( $this->title() );
        ?></strong></h1>
        <h3>Description</h3>
        <p>The Reorder Checkout Fields module provides full control over the organization of billing and shipping fields on the WooCommerce checkout page. By setting a priority number for each field, you can easily arrange fields in the exact order you want, creating a more intuitive and user-friendly checkout experience. This is especially useful for aligning your checkout flow with specific business needs or customer expectations.</p>
        <p>This module is ideal for stores looking to streamline the checkout process, ensuring that the most important fields appear first and reducing potential friction by customizing the order of information entry.</p>
        <h3>Settings</h3>
        <p>Place in each corresponding field the desired number, lower number means that the field will be on top of other fields</p>
        <h3>Appearance</h3>
        <p>The are no appearence options for this module</p>
        <?php 
        return ob_get_clean();
    }

    public function run() {
    }

    function wn_rearrange_fields( $checkout_fields ) {
    }

}
