<?php

namespace WPKIN_SHOP_MANAGER;

if ( ! defined( 'ABSPATH' ) ) {
	wp_die( esc_html__( 'You can\'t access this page', 'shop-manager' ) );
}

/**
 * Plugin Helper Class
 *
 * @since 1.0.0
 */
class Helper {


	/**
	 * Method wpkin_plugins_allowedtags.
	 * Allow html tag.
	 *
	 * @since 1.0.6
	 * @access public
	 */
	public static function wpkin_plugins_allowedtags() {
		return [
			'a'      => [
				'href'   => [],
				'title'  => [],
				'target' => [],
				'class'  => [],
				'id'     => [],
			],
			'nav'    => [
				'class' => [],
				'id'    => [],
			],
			'unit'   => [],
			'style'  => [],
			'code'   => [],
			'em'     => [],
			'strong' => [],
			'div'    => [
				'class' => [],
				'id'    => [],
			],
			'span'   => [
				'class' => [],
				'id'    => [],
			],
			'p'      => [
				'class' => [],
				'id'    => [],
			],
			'ul'     => [
				'class' => [],
				'id'    => [],
			],
			'li'     => [
				'class' => [],
				'id'    => [],
			],
			'i'      => [ 'class' => [] ],
			'h1'     => [],
			'h2'     => [],
			'h3'     => [],
			'h4'     => [],
			'h5'     => [],
			'img'    => [
				'src'   => [],
				'class' => [],
				'alt'   => [],
			],
		];
	}

	public static function wpkin_plugins_version_control(): bool {
		return defined( 'WPKIN_SM_PRO' ) && WPKIN_SM_PRO;
	}

	public static function wpkin_plugin_default_settings_data() {
		return [
			'module_settings' => [
				'orders_management'   => 1,
				'product_management'  => 1,
				'customer_management' => 1,
				'employee_management' => 1,
				'ai_chatbot'          => 1,
			],
			'employee_management' => [
				'log_retention_days' => 30,
			],
			'chatbot_settings' => [
				'enabled'              => true,
				'max_messages_per_day' => 50,
				'system_prompt_extra'  => '',
				'show_tool_calls'      => false,
			],
			'last_updated' => '2025-06-15 18:39:27',
			'orders' => [
				'order_statuses' => [
					'wc-pending'   => 'Pending payment',
					'wc-processing' => 'Processing',
					'wc-on-hold'   => 'On hold',
					'wc-completed' => 'Completed',
					'wc-cancelled' => 'Cancelled',
				],
				'custom_statuses' => [],
				'default_status_styles' => [
					'wc-pending' => [
						'id'    => 'wc-pending',
						'name'  => 'Pending payment',
						'colors' => [
							'background' => '#fff3cd',
							'text'       => '#856404',
							'border'     => '#ffeeba',
						],
					],
					'wc-processing' => [
						'id'    => 'wc-processing',
						'name'  => 'Processing',
						'colors' => [
							'background' => '#cce5ff',
							'text'       => '#004085',
							'border'     => '#b8daff',
						],
					],
					'wc-on-hold' => [
						'id'    => 'wc-on-hold',
						'name'  => 'On hold',
						'colors' => [
							'background' => '#d1ecf1',
							'text'       => '#0c5460',
							'border'     => '#bee5eb',
						],
					],
					'wc-completed' => [
						'id'    => 'wc-completed',
						'name'  => 'Completed',
						'colors' => [
							'background' => '#d4edda',
							'text'       => '#155724',
							'border'     => '#c3e6cb',
						],
					],
					'wc-cancelled' => [
						'id'    => 'wc-cancelled',
						'name'  => 'Cancelled',
						'colors' => [
							'background' => '#f8d7da',
							'text'       => '#721c24',
							'border'     => '#f5c6cb',
						],
					],
					'wc-refunded' => [
						'id'    => 'wc-refunded',
						'name'  => 'Refunded',
						'colors' => [
							'background' => '#e2e3e5',
							'text'       => '#383d41',
							'border'     => '#d6d8db',
						],
					],
					'wc-failed' => [
						'id'    => 'wc-failed',
						'name'  => 'Failed',
						'colors' => [
							'background' => '#f5c6cb',
							'text'       => '#721c24',
							'border'     => '#f1b0b7',
						],
					],
					'wc-checkout-draft' => [
						'id'    => 'wc-checkout-draft',
						'name'  => 'Draft',
						'colors' => [
							'background' => '#f0f0f0',
							'text'       => '#000000',
							'border'     => '#d9d9d9',
						],
					],
				],
				'filter_settings' => [
					'enabled'       => 1,
					'displayMode'   => 'sidebar',
					'displayStyle'  => 'accordion',
					'sections' => [
						'orderInfo' => [
							'enabled' => 1,
							'title'   => 'Order Information',
							'fields'  => [
								'orderId'        => [
									'enabled' => 1,
									'label' => 'Order ID',
								],
								'orderStatus'    => [
									'enabled' => 1,
									'label' => 'Order Status',
								],
								'dateRange'      => [
									'enabled' => 1,
									'label' => 'Date Range',
								],
								'totalRange'     => [
									'enabled' => 1,
									'label' => 'Order Total',
								],
								'paymentMethod'  => [
									'enabled' => 1,
									'label' => 'Payment Method',
								],
								'shippingMethod' => [
									'enabled' => 1,
									'label' => 'Shipping Method',
								],
							],
						],
						'customerInfo' => [
							'enabled' => 1,
							'title'   => 'Customer Information',
							'fields'  => [
								'customerName'  => [
									'enabled' => 1,
									'label' => 'Customer Name',
								],
								'customerEmail' => [
									'enabled' => 1,
									'label' => 'Customer Email',
								],
								'customerPhone' => [
									'enabled' => 1,
									'label' => 'Customer Phone',
								],
								'isGuest'       => [
									'enabled' => 1,
									'label' => 'Guest Orders',
								],
							],
						],
						'productInfo' => [
							'enabled' => 1,
							'title'   => 'Product Information',
							'fields'  => [
								'productName'     => [
									'enabled' => 1,
									'label' => 'Product Name',
								],
								'productSku'      => [
									'enabled' => 1,
									'label' => 'Product SKU',
								],
								'productCategory' => [
									'enabled' => 1,
									'label' => 'Product Category',
								],
							],
						],
						'shippingInfo' => [
							'enabled' => 1,
							'title'   => 'Shipping & Billing Information',
							'fields'  => [
								'shippingCountry' => [
									'enabled' => 1,
									'label' => 'Shipping Country',
								],
								'shippingState'   => [
									'enabled' => 1,
									'label' => 'Shipping State/Region',
								],
							],
						],
						'financialInfo' => [
							'enabled' => 1,
							'title'   => 'Financial Information',
							'fields'  => [
								'couponCode' => [
									'enabled' => 1,
									'label' => 'Coupon Code',
								],
								'isRefunded' => [
									'enabled' => 1,
									'label' => 'Refund Status',
								],
								'isPaid'     => [
									'enabled' => 1,
									'label' => 'Payment Status',
								],
							],
						],
						'otherInfo' => [
							'enabled' => 1,
							'title'   => 'Additional Search Options',
							'fields'  => [
								'orderNotes' => [
									'enabled' => 1,
									'label' => 'Order Notes',
								],
								'customMeta' => [
									'enabled' => '',
									'label' => 'Custom Meta',
								],
							],
						],
					],
				],
			],
		];
	}
}
