-- Forgot password email template (additive; safe if full patch already applied)

INSERT INTO notification_templates (
  code,
  name,
  channel,
  subject,
  html_body,
  placeholders,
  description,
  is_active
)
VALUES (
  'FORGOT_PASSWORD',
  'Forgot Password Reset',
  'EMAIL',
  'Reset your ERP password',
  '<!DOCTYPE html>
<html>
  <body style="font-family: Arial, sans-serif; color: #222; line-height: 1.5;">
    <p>Hello {{user_name}},</p>
    <p>We received a request to reset your password.</p>
    <p><a href="{{reset_url}}" style="display: inline-block; padding: 10px 16px; background: #1f4b99; color: #fff; text-decoration: none; border-radius: 4px;">Click here to reset your password</a></p>
    <p>This link expires in {{expiry_minutes}} minutes.</p>
    <p style="color: #666; font-size: 12px;">If the button does not work, open this link:<br/>{{reset_url}}</p>
    <p>If you did not request this, you can ignore this email.</p>
  </body>
</html>',
  '[
    {"key": "user_name", "description": "User full name"},
    {"key": "reset_url", "description": "Password reset frontend URL with token"},
    {"key": "expiry_minutes", "description": "Reset link expiry in minutes"}
  ]'::jsonb,
  'Sent when a user requests a password reset via forgot-password',
  true
)
ON CONFLICT (code) DO UPDATE SET
  name = EXCLUDED.name,
  channel = EXCLUDED.channel,
  subject = EXCLUDED.subject,
  html_body = EXCLUDED.html_body,
  placeholders = EXCLUDED.placeholders,
  description = EXCLUDED.description,
  is_active = true,
  deleted_at = NULL,
  updated_at = NOW();
