'use client';

import { CustomCard } from '@components/CustomCard';
import { SchemaOrg } from '@components/SchemaOrg';

const Privacy = () => {
  const schema = {
    '@context': 'https://schema.org',
    '@type': 'WebSite',
    name: 'Hackernews Newsletter',
    title: 'Privacy Policy',
    url: `${process.env.NEXT_PUBLIC_HOME_URL}/privacy`
  };

  const body = (
    <div className='privacy-content my-2 max-h-[50vh] space-y-1 overflow-auto'>
      <h2>Who We Are</h2>
      <p className='leading-relaxed'>
        Data controller: {process.env.NEXT_PUBLIC_BRAND_OWNER_NAME}, an
        individual based in {process.env.NEXT_PUBLIC_BRAND_COUNTRY}.
      </p>
      <p>
        Contact:{' '}
        <a
          href={`mailto:${process.env.NEXT_PUBLIC_BRAND_EMAIL}`}
          className='text-purple-600 hover:text-purple-700'
        >
          {process.env.NEXT_PUBLIC_BRAND_EMAIL}
        </a>
      </p>

      <h2>What We Collect</h2>
      <p className='leading-relaxed'>
        Your email address (required to send the newsletter).
      </p>

      <h2>Why We Collect It</h2>
      <p className='leading-relaxed'>
        To deliver the daily {process.env.NEXT_PUBLIC_BRAND_NAME}{' '}
        newsletter&mdash;a digest of top Hacker News stories with AI-generated
        commentary.
      </p>
      <p>
        We do not sell products, track your activity beyond essential delivery,
        or share your data for marketing.
      </p>

      <h2>Legal Basis</h2>
      <p className='leading-relaxed'>
        Your explicit consent via double opt-in signup (you receive a
        confirmation email with an activation link).
      </p>

      <h2>Third Parties</h2>
      <ul className='list-disc space-y-4 pl-6'>
        <li>
          <strong>Email delivery:</strong> Resend (US). GDPR-compliant email
          infrastructure.
        </li>
        <li>
          <strong>Hosting &amp; analytics:</strong> Vercel (US). Analytics are
          anonymized and aggregated&mdash;no personal data beyond your email is
          collected.
        </li>
        <li>
          <strong>Content source:</strong> Public Hacker News API (Y Combinator,
          US).
        </li>
      </ul>

      <h2>Your Rights</h2>
      <ul className='list-disc space-y-4 pl-6'>
        <li>Unsubscribe anytime via the link in every email</li>
        <li>
          Request deletion of your email by contacting{' '}
          <a
            href={`mailto:${process.env.NEXT_PUBLIC_BRAND_EMAIL}`}
            className='text-purple-600 hover:text-purple-700'
          >
            {process.env.NEXT_PUBLIC_BRAND_EMAIL}
          </a>
        </li>
        <li>
          Upon unsubscribe or deletion request, your email is permanently
          deleted from our database
        </li>
      </ul>

      <h2>Data Retention</h2>
      <p className='leading-relaxed'>
        We retain your email address only until you unsubscribe.
      </p>

      <h2>International Transfers</h2>
      <p className='leading-relaxed'>
        We rely on EU-approved safeguards including Standard Contractual Clauses
        to ensure adequate protection when using US-based services.
      </p>

      <h2>Changes</h2>
      <p className='leading-relaxed'>
        We may update this policy occasionally. The latest version will always
        be available at{' '}
        <a
          href={`${process.env.NEXT_PUBLIC_HOME_URL}/privacy`}
          target='_blank'
          rel='noopener noreferrer'
          className='text-purple-600 hover:text-purple-700'
        >
          {process.env.NEXT_PUBLIC_HOME_URL}/privacy
        </a>
        .
      </p>
    </div>
  );

  return (
    <>
      <SchemaOrg schema={schema} />
      <CustomCard
        className='max-90vh max-90vw'
        title='Privacy Policy'
        description='Last updated: January 28, 2026'
        content={body}
      />
    </>
  );
};

export default Privacy;
