<?php
/**
 * Privacy Policy Helper.
 *
 * @package automation-web-platform
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class WAWP_Privacy
 */
class WAWP_Privacy {

	/**
	 * Constructor.
	 */
	public function __construct() {
		add_action( 'admin_init', array( $this, 'add_privacy_policy_content' ) );
	}

	/**
	 * Add privacy policy content for the plugin.
	 */
	public function add_privacy_policy_content() {
		if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
			return;
		}

		$content = '
			<p>' . esc_html__( 'Wawp is designed with a "Local First" approach. We minimize data sharing and ensure that the majority of processing happens on your own server.', 'automation-web-platform' ) . '</p>
			<h4>' . esc_html__( 'What we collect and store', 'automation-web-platform' ) . '</h4>
			<p>' . esc_html__( 'While you visit our site, we will track:', 'automation-web-platform' ) . '</p>
			<ul>
				<li><strong>' . esc_html__( 'Abandoned Cart Tracking:', 'automation-web-platform' ) . '</strong> ' . esc_html__( 'If enabled, we track cart contents and user details (email/phone) during the checkout process to send recovery notifications.', 'automation-web-platform' ) . '</li>
				<li><strong>' . esc_html__( 'OTP Verification:', 'automation-web-platform' ) . '</strong> ' . esc_html__( 'We collect phone numbers and/or email addresses to send one-time passwords for secure login, registration, or checkout verification.', 'automation-web-platform' ) . '</li>
				<li><strong>' . esc_html__( 'Order Notifications:', 'automation-web-platform' ) . '</strong> ' . esc_html__( 'We process customer phone numbers and order details from WooCommerce to send automated status updates via WhatsApp or SMS.', 'automation-web-platform' ) . '</li>
				<li><strong>' . esc_html__( 'Email Open Tracking:', 'automation-web-platform' ) . '</strong> ' . esc_html__( 'We record when outgoing emails are opened to measure engagement. This is stored locally in your logs.', 'automation-web-platform' ) . '</li>
				<li><strong>' . esc_html__( 'Form Builder & Signup:', 'automation-web-platform' ) . '</strong> ' . esc_html__( 'Data submitted through our custom registration forms is stored in your user database.', 'automation-web-platform' ) . '</li>
				<li><strong>' . esc_html__( 'Security & Bot Detection:', 'automation-web-platform' ) . '</strong> ' . esc_html__( 'We record visitor IP addresses and browser user agent strings to detect bots and prevent fraudulent activity.', 'automation-web-platform' ) . '</li>
			</ul>
			<h4>' . esc_html__( 'Cookies', 'automation-web-platform' ) . '</h4>
			<p>' . esc_html__( 'We use cookies to keep track of abandoned cart sessions while you browse the site. Specifically:', 'automation-web-platform' ) . '</p>
			<ul>
				<li><code>wac_session</code>: ' . esc_html__( 'Helps us identify your cart session to recover it later.', 'automation-web-platform' ) . '</li>
			</ul>
			<h4>' . esc_html__( 'Who on our team has access', 'automation-web-platform' ) . '</h4>
			<p>' . esc_html__( 'Members of our team (Administrators and Shop Managers) have access to the activity logs and abandoned cart records to help manage notifications and support customers.', 'automation-web-platform' ) . '</p>
			<h4>' . esc_html__( 'What we share with others', 'automation-web-platform' ) . '</h4>
			<p>' . esc_html__( 'When sending notifications, we share recipient phone numbers and message content with third-party gateways (such as Wawp API or Meta API) to facilitate delivery. We do not share tracking or behavioral data with external services.', 'automation-web-platform' ) . '</p>
			<h4>' . esc_html__( 'Data Retention & Deletion', 'automation-web-platform' ) . '</h4>
			<p>' . esc_html__( 'Tracked data is stored locally. The plugin respects the WordPress "Erase Personal Data" tool, ensuring that all related logs are removed upon a valid erasure request.', 'automation-web-platform' ) . '</p>
		';
		wp_add_privacy_policy_content( 'Wawp - WhatsApp Automation', wp_kses_post( $content ) );
	}
}
