-- Switch existing SkyBook data to Nigerian Naira (run in phpPgAdmin if DB already has USD prices)
-- Safe to re-run. Adjust multiplier if you prefer different conversion.

UPDATE payments SET currency = 'NGN' WHERE currency IS NULL OR currency = 'USD';

-- Convert flight prices from USD to NGN (~₦1,500 per $1) — only if prices look like USD (< 10,000)
UPDATE flights SET price = ROUND(price * 1500, 0)
WHERE price < 10000;

UPDATE flight_fares SET price = ROUND(price * 1500, 0)
WHERE price < 10000;

-- Update promo minimums and fixed discounts to Naira
UPDATE promotions SET min_spend = 50000 WHERE code = 'SKYBOOK10' AND min_spend < 1000;
UPDATE promotions SET
  code = 'FLYSAVE5K',
  description = '₦5,000 off bookings over ₦300,000',
  discount_amount = 5000,
  min_spend = 300000
WHERE code = 'FLYSAVE25';

INSERT INTO promotions (code, description, discount_amount, min_spend, valid_until, max_uses)
VALUES ('FLYSAVE5K', '₦5,000 off bookings over ₦300,000', 5000, 300000, NOW() + INTERVAL '6 months', 500)
ON CONFLICT (code) DO NOTHING;

-- Refresh payment FAQ answers for Naira
UPDATE faqs SET
  answer = 'We accept Visa, Mastercard, Verve, bank transfer, USSD, and Paystack. All prices are shown in Nigerian Naira (₦).',
  keywords = 'payment,card,verve,paystack,bank,ussd,naira'
WHERE question = 'What payment methods do you accept?';

UPDATE faqs SET
  answer = 'Your card or account is charged immediately upon booking confirmation in Naira. You will see the charge as SkyBook on your statement.'
WHERE question = 'When will I be charged?';
