<?php

declare(strict_types=1);

namespace Numinix\SeekmodoWordPress\Admin;

/**
 * Suggested privacy-policy text for WordPress's Privacy Policy Guide
 * (Settings → Privacy). Seekmodo Search sends indexed content and
 * shopper search/click telemetry to the Seekmodo platform after the
 * site is paired — this block makes that explicit for site owners.
 */
final class Privacy
{
    public static function register(): void
    {
        if (!function_exists('add_action')) {
            return;
        }
        add_action('admin_init', [self::class, 'addPolicyContent']);
    }

    public static function addPolicyContent(): void
    {
        if (!function_exists('wp_add_privacy_policy_content')) {
            return;
        }

        $content = sprintf(
            '<p>%s</p><p>%s</p><p>%s</p>',
            esc_html__(
                'Seekmodo Search connects this site to the Seekmodo AI search platform (operated by Numinix Technology Inc. at mcp.seekmodo.com and admin.seekmodo.com). After an administrator pairs the site with a Seekmodo tenant, searchable post and product content you choose to index is sent to Seekmodo so visitors can search it.',
                'seekmodo'
            ),
            esc_html__(
                'Visitor search queries and clicks on search results may be sent to Seekmodo as telemetry used to improve relevance. Request metadata such as IP address, user agent, and HTTP referer may be included with those requests for abuse prevention and relevance. The plugin does not send WordPress account profiles or passwords. Additional analytics integrations, if you enable them in the Seekmodo admin, may send further data as disclosed there.',
                'seekmodo'
            ),
            sprintf(
                /* translators: %s: privacy policy URL */
                esc_html__('Full details: %s', 'seekmodo'),
                '<a href="https://seekmodo.com/legal/privacy" rel="noopener noreferrer">https://seekmodo.com/legal/privacy</a>'
            )
        );

        wp_add_privacy_policy_content(
            __('Seekmodo Search', 'seekmodo'),
            wp_kses_post($content)
        );
    }
}
