-- ══════════════════════════════════════════════════════════════════
-- SUDANNA AI OS v23 — SEED DATA (NON-EMPTY UI)
-- Safe to run multiple times (all INSERT IGNORE)
-- Does NOT overwrite existing real data
-- ══════════════════════════════════════════════════════════════════

-- ── Seed Provider Users (doctors, lawyers, etc.) ─────────────────
INSERT IGNORE INTO users (id, name, email, phone, user_type, provider_verified, created_at) VALUES
(100, 'د. أحمد محمد علي', 'dr.ahmed@sudanna.ai', '+249123456789', 'doctor', 1, NOW()),
(101, 'د. سارة عبدالله', 'dr.sara@sudanna.ai', '+249123456790', 'doctor', 1, NOW()),
(102, 'د. خالد عمر', 'dr.khaled@sudanna.ai', '+249123456791', 'doctor', 1, NOW()),
(103, 'أ. فاطمة محمد', 'lawyer.fatima@sudanna.ai', '+249123456792', 'lawyer', 1, NOW()),
(104, 'أ. عمر الأمين', 'lawyer.omar@sudanna.ai', '+249123456793', 'lawyer', 1, NOW()),
(105, 'م. نورا سالم', 'eng.nora@sudanna.ai', '+249123456794', 'service_provider', 1, NOW());

-- ── Seed Wallets for all users ────────────────────────────────────
INSERT IGNORE INTO wallet (user_id, balance_sdg, kyc_level, status, created_at)
SELECT id, 0.00, 0, 'active', NOW() FROM users WHERE id NOT IN (SELECT user_id FROM wallet);

-- ── Seed Provider Services ────────────────────────────────────────
INSERT IGNORE INTO provider_services (provider_id, service_type, title_ar, price_sdg, available, created_at) VALUES
(100, 'medical', 'استشارة طبية عامة', 250.00, 1, NOW()),
(101, 'medical', 'طب الأطفال', 300.00, 1, NOW()),
(102, 'medical', 'طب الباطنية', 350.00, 1, NOW()),
(103, 'legal', 'قانون الأسرة والميراث', 500.00, 1, NOW()),
(104, 'legal', 'العقود التجارية', 800.00, 1, NOW()),
(105, 'engineering', 'استشارة هندسة مدنية', 600.00, 1, NOW());

-- ── Seed feature flags ────────────────────────────────────────────
INSERT IGNORE INTO feature_flags (flag_key, enabled, description) VALUES
('demo_mode', 1, 'Demo mode available'),
('trust_badges', 1, 'Show trust badges on payment screens'),
('fail_safe_ux', 1, 'Show fail-safe messages to users');

-- Verify
SELECT 'users' AS tbl, COUNT(*) FROM users WHERE id >= 100 AND id <= 105
UNION SELECT 'wallets', COUNT(*) FROM wallet
UNION SELECT 'feature_flags', COUNT(*) FROM feature_flags;
