-- =====================================================================
-- Seed Data — Default Packages, Permissions, System Settings
-- =====================================================================
USE ispbdcom_isp_billing;

-- ---- Default Packages ----
INSERT INTO packages (tier, name, speed_mbps, price, public_ip, status) VALUES
('Lite',    'Lite 30 Mbps',     30,  525.00, 0, 'active'),
('Lite',    'Lite 50 Mbps',     50,  630.00, 0, 'active'),
('Lite',    'Lite 70 Mbps',     70,  780.00, 0, 'active'),
('Lite',    'Lite 90 Mbps',     90,  980.00, 0, 'active'),
('Regular', 'Regular 100 Mbps', 100, 1050.00, 0, 'active'),
('Regular', 'Regular 120 Mbps', 120, 1150.00, 0, 'active'),
('Regular', 'Regular 140 Mbps', 140, 1360.00, 0, 'active'),
('Regular', 'Regular 160 Mbps', 160, 1575.00, 0, 'active'),
('Premium', 'Premium 200 Mbps', 200, 2200.00, 1, 'active'),
('Premium', 'Premium 250 Mbps', 250, 2800.00, 1, 'active'),
('Premium', 'Premium 300 Mbps', 300, 3800.00, 1, 'active');

-- ---- Default Role Permission Matrix ----
INSERT INTO permissions (role, module_key, allowed) VALUES
('super_admin', 'all', 1),
('admin', 'customers.manage', 1),
('admin', 'routers.manage', 1),
('admin', 'packages.manage', 1),
('admin', 'resellers.manage', 1),
('admin', 'billing.manage', 1),
('admin', 'reports.view', 1),
('reseller', 'customers.manage_own', 1),
('reseller', 'billing.view_own', 1),
('reseller', 'reports.view_own', 1),
('sub_reseller', 'customers.manage_own', 1),
('support', 'tickets.manage', 1),
('support', 'customers.view', 1),
('admin', 'backups.manage', 1),
('admin', 'sessions.manage_all', 1);

-- ---- Payment Gateways (disabled until admin adds real credentials) ----
INSERT INTO payment_gateways (gateway_key, display_name, mode, is_enabled) VALUES
('bkash', 'bKash Tokenized Checkout', 'sandbox', 0),
('sslcommerz', 'SSLCommerz (Card/Nagad/Rocket/Bank)', 'sandbox', 0);

-- ---- Core System Settings (auto-save / sync configuration placeholders) ----
INSERT INTO system_settings (setting_key, setting_value) VALUES
('site_name', 'One Step ISP Solution'),
('company_name', ''),
('currency', 'BDT'),
('auto_backup_enabled', '1'),
('auto_backup_time', '03:00'),
('multi_device_sync_enabled', '1'),
('sms_gateway_provider', ''),
('whatsapp_api_provider', ''),
('theme_mode', 'dark'),
('isp_license_no', ''),
('isp_license_class', ''),
('isp_noc_area', ''),
('backup_retention_days', '14'),
('backup_last_run_at', ''),
('backup_remote_enabled', '0'),
('backup_remote_host', ''),
('backup_remote_port', '21'),
('backup_remote_username', ''),
('backup_remote_path', '/backups'),
('backup_remote_creds_enc', ''),
('sync_session_lifetime_minutes', '120');
