<?php
/**
 * Privacy Policy Template
 */
defined('ABSPATH') or exit;

$fajaedeseo_company_name = get_option('fajaedeseo_company_name', get_bloginfo('name'));
$fajaedeseo_company_address = get_option('fajaedeseo_company_address', '');
$fajaedeseo_company_email = get_option('fajaedeseo_company_email', get_option('admin_email'));
$fajaedeseo_website_url = get_option('fajaedeseo_website_url', home_url());
$fajaedeseo_data_collected_personal = get_option('fajaedeseo_data_collected_personal', '0');
$fajaedeseo_data_collected_usage = get_option('fajaedeseo_data_collected_usage', '0');
$fajaedeseo_data_sharing_third_parties = get_option('fajaedeseo_data_sharing_third_parties', '0');
$fajaedeseo_data_sharing_analytics = get_option('fajaedeseo_data_sharing_analytics', '0');
$fajaedeseo_data_sharing_ads = get_option('fajaedeseo_data_sharing_ads', '0');
$fajaedeseo_data_security_measures = get_option('fajaedeseo_data_security_measures', __('We implement various security measures to maintain the safety of your personal information.', 'fajaedeseo-ai'));
$fajaedeseo_user_rights_access = get_option('fajaedeseo_user_rights_access', '1');
$fajaedeseo_user_rights_deletion = get_option('fajaedeseo_user_rights_deletion', '1');
$fajaedeseo_cookies_used = get_option('fajaedeseo_cookies_used', __('We use cookies to enhance your experience on our website.', 'fajaedeseo-ai'));
$fajaedeseo_contact_info_policy = get_option('fajaedeseo_contact_info_policy', __('If you have any questions about this Privacy Policy, please contact us.', 'fajaedeseo-ai'));
$fajaedeseo_is_free_tier = (FajaedeSEO_Pro_License::get_plan_level() === FajaedeSEO_Pro_License::PLAN_FREE);
?>

<p>This Privacy Policy describes how <?php echo esc_html($fajaedeseo_company_name); ?> ("we," "us," or "our") collects, uses, and discloses your information when you visit <?php echo esc_url($fajaedeseo_website_url); ?> (the "Service").</p>
<p><strong>Last updated: <?php echo esc_html(date_i18n(get_option('date_format'))); ?></strong></p>

<?php if ($fajaedeseo_is_free_tier) : ?>
    <div style="background:#fffbea; padding:12px; margin:15px 0; border-left:3px solid #ffc107;">
        <p style="margin:0;"><strong style="color:#ff9800;">ℹ️ Free Tier:</strong> This is a basic template. <strong>Upgrade to Pro</strong> for GDPR-compliant, fully customized policies.</p>
    </div>
<?php endif; ?>

<h2>Information We Collect</h2>
<p>We collect different types of information for various purposes to provide and improve our Service to you.</p>

<?php if ($fajaedeseo_data_collected_personal === '1') : ?>
    <h3>Personal Data</h3>
    <p>While using our Service, we may ask you to provide us with certain personally identifiable information that can be used to contact or identify you ("Personal Data"). Personally identifiable information may include, but is not limited to:</p>
    <ul>
        <li>Email address</li>
        <li>First name and last name</li>
        <li>Address, State, Province, ZIP/Postal code, City</li>
        <li>Cookies and Usage Data</li>
    </ul>
<?php endif; ?>

<?php if ($fajaedeseo_data_collected_usage === '1') : ?>
    <h3>Usage Data</h3>
    <p>We may also collect information how the Service is accessed and used ("Usage Data"). This Usage Data may include information such as your computer's Internet Protocol address (e.g. IP address), browser type, browser version, the pages of our Service that you visit, the time and date of your visit, the time spent on those pages, unique device identifiers and other diagnostic data.</p>
<?php endif; ?>

<h2>Use of Data</h2>
<p><?php echo esc_html($fajaedeseo_company_name); ?> uses the collected data for various purposes:</p>
<ul>
    <li>To provide and maintain the Service</li>
    <li>To notify you about changes to our Service</li>
    <li>To allow you to participate in interactive features of our Service when you choose to do so</li>
    <li>To provide customer support</li>
    <li>To gather analysis or valuable information so that we can improve the Service</li>
    <li>To monitor the usage of the Service</li>
    <li>To detect, prevent and address technical issues</li>
</ul>

<?php if ($fajaedeseo_data_sharing_third_parties === '1' || $fajaedeseo_data_sharing_analytics === '1' || $fajaedeseo_data_sharing_ads === '1') : ?>
    <h2>Disclosure Of Data</h2>
    <p>We may disclose your Personal Data in the good faith belief that such action is necessary to:</p>
    <ul>
        <li>To comply with a legal obligation</li>
        <li>To protect and defend the rights or property of <?php echo esc_html($fajaedeseo_company_name); ?></li>
        <li>To prevent or investigate possible wrongdoing in connection with the Service</li>
        <li>To protect the personal safety of users of the Service or the public</li>
        <li>To protect against legal liability</li>
        <?php if ($fajaedeseo_data_sharing_third_parties === '1') echo '<li>With third-party service providers to monitor and analyze the use of our Service.</li>'; ?>
        <?php if ($fajaedeseo_data_sharing_analytics === '1') echo '<li>With analytics providers to track and report website traffic.</li>'; ?>
        <?php if ($fajaedeseo_data_sharing_ads === '1') echo '<li>With advertising partners to show you advertisements that are relevant to you.</li>'; ?>
    </ul>
<?php endif; ?>

<h2>Security Of Data</h2>
<p><?php echo esc_html($fajaedeseo_data_security_measures); ?></p>

<?php if ($fajaedeseo_user_rights_access === '1' || $fajaedeseo_user_rights_deletion === '1') : ?>
    <h2>Your Data Protection Rights</h2>
    <p>Depending on your location, you may have the following data protection rights:</p>
    <ul>
        <?php if ($fajaedeseo_user_rights_access === '1') echo '<li>The right to access, update or to delete the information we have on you.</li>'; ?>
        <?php if ($fajaedeseo_user_rights_deletion === '1') echo '<li>The right to request that we delete your personal data.</li>'; ?>
    </ul>
<?php endif; ?>

<h2>Cookies</h2>
<p><?php echo esc_html($fajaedeseo_cookies_used); ?></p>

<h2>Contact Us</h2>
<p><?php echo esc_html($fajaedeseo_contact_info_policy); ?></p>
<ul>
    <li>Email: <a href="mailto:<?php echo esc_attr($fajaedeseo_company_email); ?>"><?php echo esc_html($fajaedeseo_company_email); ?></a></li>
    <?php if (!empty($fajaedeseo_company_address)) echo '<li>Address: ' . esc_html($fajaedeseo_company_address) . '</li>'; ?>
</ul>
