import Link from 'next/link';
import { LegalDocument } from '@/components/marketing/LegalDocument';
import type { LegalSection } from '@/components/marketing/LegalDocument';
import { pageMetadata } from '@/lib/site';

export const metadata = pageMetadata({
  title: 'Privacy notice (draft)',
  description:
    'Draft PintRush privacy notice, pending lawyer review: what we collect from players, venues and pilot applicants, cookie-less analytics, and 90-day guest data deletion.',
  path: '/legal/privacy',
});

const sections: LegalSection[] = [
  {
    id: 'who-we-are',
    title: 'Who we are',
    body: (
      <p>
        PintRush (“PintRush”, “we”, “us”) provides live trivia games that bars and similar venues show on their TVs and that guests play on their
        own phones. [Legal entity name, registered address and company number — to be confirmed.]
      </p>
    ),
  },
  {
    id: 'what-we-collect',
    title: 'Information we collect',
    body: (
      <>
        <p>
          <strong>Guests (players).</strong> A nickname, an optional team name, a random identifier for your device so you can rejoin a game, and
          your gameplay (answers, answer times, scores, power-ups used). We do not ask players for their name, email address, phone number or an
          account.
        </p>
        <p>
          <strong>Venue customers.</strong> Contact details of venue staff, sign-in details (passwords are stored only as secure hashes), venue
          settings, schedules and the games you run.
        </p>
        <p>
          <strong>Pilot applicants.</strong> The details you enter in the pilot form: venue name, address, contact name, email address, optional
          phone number, number of TVs, busiest nights, current entertainment and your message. To block spam we also store a hash of your IP
          address made with a secret, daily-changing salt; we never store the IP address itself.
        </p>
        <p>
          <strong>Website visits.</strong> When you browse our marketing pages we count page views using the page path and, if present, the
          domain of the website that referred you. We use no cookies for this, store no IP addresses, and record nothing when your browser sends a
          Do Not Track or Global Privacy Control signal.
        </p>
      </>
    ),
  },
  {
    id: 'how-we-use',
    title: 'How we use information',
    body: (
      <ul>
        <li>To run games, show leaderboards and keep play fair (including an audit log that lets us check disputed results).</li>
        <li>To moderate nicknames and prevent abuse, cheating and spam.</li>
        <li>To give venues aggregate metrics such as joins, rounds played and repeat players.</li>
        <li>To respond to pilot applications and run the pilot program.</li>
        <li>To secure, maintain and improve the service.</li>
      </ul>
    ),
  },
  {
    id: 'cookies',
    title: 'Cookies and device storage',
    body: (
      <p>
        Our marketing pages set no tracking or advertising cookies. Venue host and admin dashboards use a strictly necessary sign-in cookie.
        Guest play may keep a session token on your device so you can reconnect to a game. [Final list of cookies and storage — to be confirmed.]
      </p>
    ),
  },
  {
    id: 'sharing',
    title: 'Sharing',
    body: (
      <>
        <p>We do not sell personal information. Venues see the nicknames, teams and scores from games played in their own venue.</p>
        <p>
          We use service providers for hosting, databases and email, who process data only on our instructions. [List of providers — to be
          confirmed.] We may disclose information when required by law.
        </p>
      </>
    ),
  },
  {
    id: 'retention',
    title: 'How long we keep it',
    body: (
      <ul>
        <li>Guest play data (nicknames, device identifiers, answers and scores) is deleted automatically after 90 days.</li>
        <li>Pilot applications are kept until they are deleted, on request or once no longer needed.</li>
        <li>Venue account data is kept while the account is active. [Post-termination retention period — to be confirmed.]</li>
        <li>Page-view counts are kept in aggregate form. [Retention period — to be confirmed.]</li>
      </ul>
    ),
  },
  {
    id: 'security',
    title: 'Security',
    body: (
      <p>
        We use reasonable technical and organisational measures to protect information, including hashed passwords, encrypted connections and
        strict separation of each venue’s data. No system is perfectly secure.
      </p>
    ),
  },
  {
    id: 'children',
    title: 'Children',
    body: (
      <p>
        PintRush is designed for guests of bars and similar venues and is not directed to children under 13. [Age requirements to be confirmed
        with counsel.]
      </p>
    ),
  },
  {
    id: 'your-rights',
    title: 'Your choices and rights',
    body: (
      <p>
        You can ask us to access, correct or delete personal information we hold about you. We honour Global Privacy Control and Do Not Track
        signals on our website. [State-specific rights and how to exercise them — to be reviewed by counsel.]
      </p>
    ),
  },
  {
    id: 'changes',
    title: 'Changes to this notice',
    body: <p>We will update the date at the top when this notice changes and give notice of material changes where required.</p>,
  },
  {
    id: 'contact',
    title: 'Contact',
    body: (
      <p>
        [Privacy contact email and postal address — to be confirmed.] Questions in the meantime can be sent through the{' '}
        <Link href="/pilot" className="font-semibold text-violet-soft underline-offset-4 hover:underline">
          pilot form
        </Link>
        .
      </p>
    ),
  },
];

export default function PrivacyPage() {
  return (
    <LegalDocument
      title="Privacy notice"
      updated="[date of publication]"
      intro={<p>PintRush is built to need as little personal information as possible. This notice explains what we collect and why.</p>}
      sections={sections}
    />
  );
}
