import type { Metadata } from "next";
import Link from "next/link";
import { COMPANY, SUPPORT_EMAIL, PRIVACY_EMAIL, LAST_UPDATED } from "../legal-config";

export const metadata: Metadata = {
  title: `Privacy Policy — ${COMPANY}`,
  description: `How ${COMPANY} collects, uses, and protects your information, including SMS/text messaging.`,
};

export default function PrivacyPage() {
  return (
    <main className="legal-wrap">
      <h1>Privacy Policy</h1>
      <p className="updated">Last updated: {LAST_UPDATED}</p>

      <p>
        This Privacy Policy explains how {COMPANY} (&quot;{COMPANY},&quot; &quot;we,&quot;
        &quot;us&quot;) collects, uses, and protects your information when you use our
        website, portal, and services, including our text message (SMS) program.
      </p>

      <h2>Information we collect</h2>
      <ul>
        <li><strong>Account information</strong> — name, email address, and mobile phone number you provide when registering or signing in.</li>
        <li><strong>Property and service information</strong> — details you share to request roof inspections, estimates, and reports.</li>
        <li><strong>Usage and device information</strong> — log data, device and browser type, and similar technical information collected automatically.</li>
      </ul>

      <h2>How we use your information</h2>
      <ul>
        <li>To create and secure your account, including sending one-time verification codes (OTP).</li>
        <li>To provide, maintain, and improve our services.</li>
        <li>To communicate with you about your account, appointments, estimates, and support requests.</li>
        <li>To comply with legal obligations and protect against fraud and abuse.</li>
      </ul>

      <h2>SMS / text messaging</h2>
      <div className="legal-callout">
        <p>
          <strong>
            We do not sell, rent, or share your mobile phone number, or your SMS opt-in
            consent, with any third parties or affiliates for their marketing or
            promotional purposes.
          </strong>
        </p>
        <p>
          Mobile information collected for the purpose of sending text messages is used
          only to deliver the messages you opted into and is not shared with third parties
          for marketing. We may share your number only with service providers (such as our
          messaging platform) strictly to deliver the messages, and as required by law.
        </p>
        <p>
          <strong>Message frequency varies</strong> — verification codes are sent when you
          request them (for example, each time you sign in or register), and account or
          service notifications are occasional. <strong>Message and data rates may
          apply</strong>, depending on your mobile carrier and plan.
        </p>
        <p>
          You can opt out at any time by replying <strong>STOP</strong> to any message, and
          get help by replying <strong>HELP</strong>. See our{" "}
          <Link href="/terms">Terms of Service</Link> and the{" "}
          <Link href="/sms-opt-in">SMS opt-in page</Link> for full program details.
        </p>
      </div>

      <h2>How we share information</h2>
      <p>
        We do not sell your personal information. We share information only with service
        providers who help us operate the service (for example, cloud hosting,
        authentication, and messaging providers), and when required by law or to protect
        our rights. As stated above, mobile phone numbers and SMS consent are never shared
        with third parties or affiliates for marketing purposes.
      </p>

      <h2>Data retention and security</h2>
      <p>
        We retain personal information for as long as your account is active or as needed to
        provide the service and meet legal obligations. We use administrative, technical,
        and physical safeguards designed to protect your information; no method of
        transmission or storage is completely secure.
      </p>

      <h2>Your choices and rights</h2>
      <p>
        You may access or update your account information at any time, opt out of SMS by
        replying STOP, and request deletion of your account by contacting us. Depending on
        your location, you may have additional rights under applicable privacy laws.
      </p>

      <h2>Contact us</h2>
      <p>
        Questions about this Privacy Policy? Email us at{" "}
        <a href={`mailto:${PRIVACY_EMAIL}`}>{PRIVACY_EMAIL}</a> or{" "}
        <a href={`mailto:${SUPPORT_EMAIL}`}>{SUPPORT_EMAIL}</a>.
      </p>
    </main>
  );
}
