<?php
/**
 * Privacy Policy integration for Vareon Calculator Suite Lite.
 *
 * Registers recommended privacy policy content with WordPress.
 *
 * @package Vareon_Calculator_Suite_Lite
 */

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

/**
 * Add privacy policy content to the WordPress Privacy Policy Guide.
 *
 * @return void
 */
function vareoncalc_lite_add_privacy_policy_content() {
	if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
		return;
	}

	$content = sprintf(
		'<h2>%s</h2>
<p>%s</p>

<h3>%s</h3>
<p>%s</p>

<h3>%s</h3>
<p>%s</p>
<ul>
<li><strong>%s</strong> %s</li>
<li><strong>%s</strong> %s</li>
<li><strong>%s</strong> %s</li>
</ul>

<h3>%s</h3>
<p>%s</p>
<ul>
<li><strong>%s</strong> %s</li>
<li><strong>%s</strong> %s</li>
</ul>

<h3>%s</h3>
<p>%s</p>

<h3>%s</h3>
<p>%s</p>',
		esc_html__( 'Vareon Calculator Suite Lite', 'vareon-calculator-suite-lite' ),
		esc_html__( 'This site uses Vareon Calculator Suite Lite to provide interactive calculators. The following describes how this plugin handles data.', 'vareon-calculator-suite-lite' ),
		// Cookies.
		esc_html__( 'Cookies', 'vareon-calculator-suite-lite' ),
		esc_html__( 'This plugin does not set any cookies.', 'vareon-calculator-suite-lite' ),
		// Browser storage.
		esc_html__( 'Browser Local Storage', 'vareon-calculator-suite-lite' ),
		esc_html__( 'This plugin uses browser localStorage for functional purposes only (not for analytics or tracking):', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Measurement preference:', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Remembers your preferred measurement system (metric or imperial) so you don\'t have to select it each time you use a calculator.', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Admin preview state (key: vareoncalc_lite_preview_v2_state):', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Stores administrator-only settings preview preferences such as selected calculator type, preview width, zoom level, and pan position in wp-admin.', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Admin notice dismissal:', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Remembers when an administrator dismisses the in-settings tip notice so it stays hidden for that administrator in future sessions.', 'vareon-calculator-suite-lite' ),
		// Database storage.
		esc_html__( 'Database Storage', 'vareon-calculator-suite-lite' ),
		esc_html__( 'For logged-in administrators, this plugin may store:', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Notice Dismissals:', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Dismissal preferences for admin notices and in-settings tips.', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Site Settings:', 'vareon-calculator-suite-lite' ),
		esc_html__( 'Theme preferences, currency settings, and calculator configuration.', 'vareon-calculator-suite-lite' ),
		// External services.
		esc_html__( 'External Services', 'vareon-calculator-suite-lite' ),
		esc_html__( 'All calculations are performed locally in your browser. The plugin also includes an admin-only Pro Waitlist tab with a link to vareon.dev. No waitlist form data is collected inside the plugin itself; any optional signup happens only after an administrator chooses to continue to the Vareon website.', 'vareon-calculator-suite-lite' ),
		// Data removal.
		esc_html__( 'Data Removal', 'vareon-calculator-suite-lite' ),
		esc_html__( 'When this plugin is deleted via the WordPress admin, all stored database data (settings and dismissed admin notices) is automatically removed. Browser localStorage entries remain in each browser until cleared by the user or overwritten by the browser.', 'vareon-calculator-suite-lite' )
	);

	wp_add_privacy_policy_content(
		__( 'Vareon Calculator Suite Lite', 'vareon-calculator-suite-lite' ),
		wp_kses_post( $content )
	);
}
add_action( 'admin_init', 'vareoncalc_lite_add_privacy_policy_content' );
