<?php

namespace Clonable\Models;

use Clonable\Helpers\Locales;
use Clonable\Helpers\MultiCurrency;
use Clonable\Services\MultiCurrencyService;

class ClonableWooCommerce {
    const PAGE = "woocommerce";

    public static $fields = [
        "clonable_woocommerce_module_enabled" => [
            "render" => "clonable_woocommerce_module_enabled_field",
            "name" => "Enable WooCommerce module",
            "setting" => "clonable_woocommerce_module_enabled",
            "description" => "This is the master setting of the WooCommerce module, turn this off if you wish to disable this module.",
        ],
        "clonable_woocommerce_exclusions_enabled" => [
            "render" => "clonable_woocommerce_exclusions_enabled_field",
            "name" => "Enable product exclusions",
            "setting" => "clonable_product_exclusions_enabled",
            "description" => "Allows you to exclude product for specific clones.",
        ],
	    "clonable_woocommerce_analytics_enabled" => [
		    "render" => "clonable_woocommerce_analytics_enabled_field",
		    "name" => "Enable conversion tracking",
		    "setting" => "clonable_woocommerce_analytics_enabled",
            "description" => "Changes the redirect url of the payment provider to the domain of the last visited clone.",
	    ],
        "clonable_woocommerce_analytics" => [
            "render" => "clonable_woocommerce_analytics_field",
            "name" => "Valid redirect locations",
            "setting" => "clonable_woocommerce_allowed_origins",
        ],
        "clonable_default_country_by_domain" => [
            "render" => "clonable_default_country_by_domain_field",
            "name" => "Default checkout country by domain",
            "setting" => "clonable_default_country_by_domain",
        ],
    ];

	public static function get_woocommerce_countries(): array {
        if (!class_exists('\WC_Countries')) {
            return [];
        }
        $wc_countries = new \WC_Countries();
        return array_keys($wc_countries->get_countries());
    }
}