import { Controller, Get, Header } from '@nestjs/common';

@Controller()
export class AppController {
  @Get()
  @Header('Content-Type', 'text/html')
  getRoot(): string {
    return `
      <!DOCTYPE html>
      <html>
        <head><title>WhatsApp Commerce Hub</title></head>
        <body style="font-family: sans-serif; padding: 40px; background: #0b0f19; color: #fff;">
          <h1>WhatsApp Commerce Hub</h1>
          <p>Multi-tenant WhatsApp Business & E-Commerce Automation Platform.</p>
          <p><a href="/privacy" style="color: #10b981;">Privacy Policy</a> | <a href="/data-deletion" style="color: #10b981;">User Data Deletion</a></p>
        </body>
      </html>
    `;
  }

  @Get('privacy')
  @Header('Content-Type', 'text/html')
  getPrivacyPolicy(): string {
    return `
      <!DOCTYPE html>
      <html>
        <head><title>Privacy Policy - WhatsApp Commerce Hub</title></head>
        <body style="font-family: sans-serif; padding: 40px; max-width: 800px; margin: auto; line-height: 1.6;">
          <h1>Privacy Policy</h1>
          <p>Last updated: September 17, 2026</p>
          <p>WhatsApp Commerce Hub ("we", "our", or "us") respects your privacy. This policy explains how we handle your personal data when you use our WhatsApp commerce services.</p>
          <h3>1. Data We Collect</h3>
          <p>We collect phone numbers, order details, and customer messages strictly necessary to process shopping inquiries, catalog navigation, and order fulfillment through WhatsApp.</p>
          <h3>2. How We Use Data</h3>
          <p>Data is used exclusively to facilitate commerce communication between merchants and their customers via the Meta WhatsApp Cloud API.</p>
          <h3>3. Data Sharing</h3>
          <p>We do not sell, lease, or share your personal data with third parties except as needed to fulfill your orders (e.g. payment processors and delivery drivers).</p>
          <h3>4. Contact Us</h3>
          <p>If you have any questions, please contact us at support@quatrohaus.com.</p>
        </body>
      </html>
    `;
  }

  @Get('data-deletion')
  @Header('Content-Type', 'text/html')
  getDataDeletionInstructions(): string {
    return `
      <!DOCTYPE html>
      <html>
        <head><title>User Data Deletion Instructions - WhatsApp Commerce Hub</title></head>
        <body style="font-family: sans-serif; padding: 40px; max-width: 800px; margin: auto; line-height: 1.6;">
          <h1>User Data Deletion Instructions</h1>
          <p>WhatsApp Commerce Hub provides automated shopping and order support on WhatsApp. In accordance with Meta Platform policies, users have the right to request the deletion of their personal data.</p>
          <h3>How to Request Data Deletion:</h3>
          <ol>
            <li>Send an email to <strong>support@quatrohaus.com</strong> with the subject line <em>"Data Deletion Request"</em>.</li>
            <li>Include your WhatsApp phone number associated with your chat or orders.</li>
            <li>Alternatively, send a message containing <strong>"reset"</strong> or <strong>"delete my data"</strong> to our WhatsApp chatbot.</li>
          </ol>
          <p>Upon receiving your request, our team will purge your contact details, chat logs, and active shopping sessions from our database within 48 hours and send a confirmation.</p>
        </body>
      </html>
    `;
  }
}
