-- Check if the email template exists and has content
SELECT
  key,
  name,
  is_active,
  email_subject,
  LENGTH(email_body_html) as html_length,
  SUBSTRING(email_body_html, 1, 500) as html_preview,
  CASE
    WHEN email_body_html IS NULL THEN 'NULL - empty template'
    WHEN LENGTH(email_body_html) < 100 THEN 'TOO SHORT - template incomplete'
    WHEN email_body_html LIKE '%<html>%' THEN 'Has HTML tag'
    WHEN email_body_html LIKE '%---%' THEN 'Has YAML delimiters'
    ELSE 'Unknown format'
  END as template_status
FROM notification_templates
WHERE key = 'auth_email_verification';
