-- Admin için tenant oluşturma SQL
USE hat_messaging;

-- Admin user ID'sini bul ve tenant ekle
INSERT INTO tenants (user_id, company_name, service_type, max_numbers, max_daily_messages, status)
SELECT id, 'Platform Admin', 'full_service', 100, 10000, 'active'
FROM users 
WHERE email = 'admin@whatsapp-platform.local'
AND NOT EXISTS (
    SELECT 1 FROM tenants WHERE user_id = users.id
);

-- Kontrol et
SELECT u.id as user_id, u.email, t.id as tenant_id, t.company_name, t.service_type
FROM users u
LEFT JOIN tenants t ON u.id = t.user_id
WHERE u.email = 'admin@whatsapp-platform.local';
