<?php

declare(strict_types=1);

namespace CliqThemes\StoreLocator\Privacy;

defined('ABSPATH') || exit;

/**
 * Suggested privacy-policy text for the WordPress Privacy Policy Guide.
 *
 * Store records are content an administrator enters. The plugin keeps no
 * visitor submissions and records no analytics, so it registers no personal
 * data exporter or eraser.
 */
final class Privacy
{
    public function register(): void
    {
        add_action('admin_init', [$this, 'addPolicyContent']);
    }

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

        $content = '<p>' . esc_html__(
            'Cliq Store Locator stores the store records an administrator enters. Visitor searches are not recorded. Depending on the configured map provider, geocoder, IP-location fallback and font, a visitor\'s browser or this site may contact OpenStreetMap, Nominatim, OSRM, GeoJS, Google Maps Platform or Google Fonts, which receive the visitor\'s IP address and normal request information. The plugin readme lists every service with its terms and privacy policy.',
            'cliq-store-locator'
        ) . '</p>';

        wp_add_privacy_policy_content(
            __('Cliq Store Locator', 'cliq-store-locator'),
            wp_kses_post(wpautop($content, false))
        );
    }
}