-- Migration 050: Seed ftt_tab_feature_toggles for core FTT tabs.
-- Feature keys match the actual config_key values used in app_admin_config and
-- the name= attributes in the corresponding config pages (camera_config.php, etc.).
-- All features default to enabled=1 - admins can toggle them off via the Features tab
-- in admin_tab_policy.php.
-- Safe to re-run: uses INSERT IGNORE on the unique key (tab_id, feature_key).

-- ============================================================
-- Camera Tab (cameraTab)
-- Source: web2/camera_config.php
-- ============================================================
INSERT IGNORE INTO ftt_tab_feature_toggles
    (tab_id, feature_key, feature_label, feature_description, enabled, updated_at)
VALUES
    ('cameraTab', 'app_ui_camera_overlay_mode', 'Camera Overlay Mode',
        'Show camera stream as a floating overlay while using other tabs', 1, NOW()),
    ('cameraTab', 'app_ui_uvc_full_screen', 'UVC Full Screen Mode',
        'Allow USB camera (UVC) to take over the full screen', 1, NOW()),
    ('cameraTab', 'camera_upload_quality', 'Upload Quality Control',
        'Enable configurable image quality/resolution for uploads', 1, NOW());

-- ============================================================
-- Wireless / Speed Test Tab (wirelessTab)
-- Source: web2/wireless_config.php
-- ============================================================
INSERT IGNORE INTO ftt_tab_feature_toggles
    (tab_id, feature_key, feature_label, feature_description, enabled, updated_at)
VALUES
    ('wirelessTab', 'speedtest_enabled', 'Speed Test',
        'Enable the speed test module on the Wireless tab', 1, NOW()),
    ('wirelessTab', 'speedtest_allow_wifi', 'WiFi Speed Test',
        'Allow running speed tests over WiFi connections', 1, NOW()),
    ('wirelessTab', 'speedtest_allow_mobile', 'Mobile Speed Test',
        'Allow running speed tests over mobile/cellular connections', 1, NOW()),
    ('wirelessTab', 'speedtest_allow_ethernet', 'Ethernet Speed Test',
        'Allow running speed tests over wired Ethernet connections', 1, NOW());

-- ============================================================
-- Testing / Hardware Testing Tab (testingTab)
-- Source: web2/testing_config.php
-- ============================================================
INSERT IGNORE INTO ftt_tab_feature_toggles
    (tab_id, feature_key, feature_label, feature_description, enabled, updated_at)
VALUES
    ('testingTab', 'testing_enabled', 'Hardware Testing Module',
        'Master toggle for the hardware testing module', 1, NOW()),
    ('testingTab', 'network_enabled', 'Network Module',
        'Enable network diagnostics within the testing tab', 1, NOW()),
    ('testingTab', 'wireless_enabled', 'Wireless Module',
        'Enable wireless diagnostics within the testing tab', 1, NOW()),
    ('testingTab', 'speedtest_enabled', 'Speed Test',
        'Enable speed test within the testing tab', 1, NOW()),
    ('testingTab', 'cable_tester_mode_tone_enabled', 'Cable Toner Mode',
        'Enable cable tone/tracer mode in the cable tester', 1, NOW()),
    ('testingTab', 'cable_tester_mode_certify_enabled', 'Cable Certification Mode',
        'Enable cable certification/qualification tests', 1, NOW()),
    ('testingTab', 'cable_tester_mode_poe_enabled', 'PoE Detection Mode',
        'Enable Power-over-Ethernet detection and measurement', 1, NOW());

-- ============================================================
-- Drive Cloner Tab (driveClonerTab)
-- Source: web2/drive_cloner_config.php
-- ============================================================
INSERT IGNORE INTO ftt_tab_feature_toggles
    (tab_id, feature_key, feature_label, feature_description, enabled, updated_at)
VALUES
    ('driveClonerTab', 'drive_cloner_enabled', 'Drive Cloner',
        'Master toggle for the drive cloner module', 1, NOW()),
    ('driveClonerTab', 'worker_control_enabled', 'Worker Control',
        'Enable remote worker process control from the Drive Cloner tab', 1, NOW()),
    ('driveClonerTab', 'worker_installer_enabled', 'Worker Installer',
        'Enable the worker package installer within the Drive Cloner tab', 1, NOW());

-- ============================================================
-- Web Server Tab (webserverTab)
-- Source: web2/web_server_config.php
-- ============================================================
INSERT IGNORE INTO ftt_tab_feature_toggles
    (tab_id, feature_key, feature_label, feature_description, enabled, updated_at)
VALUES
    ('webserverTab', 'app_ui_show_webserver_section', 'Web Server Section',
        'Show the in-app HTTP server section for serving static files', 1, NOW());

-- ============================================================
-- AI Agent Tab (agentTab)
-- Source: web2/agent_config.php
-- ============================================================
INSERT IGNORE INTO ftt_tab_feature_toggles
    (tab_id, feature_key, feature_label, feature_description, enabled, updated_at)
VALUES
    ('agentTab', 'agent_chat_enabled', 'AI Agent Chat',
        'Enable the AI agent chat interface', 1, NOW());

INSERT IGNORE INTO _ftt_migrations (filename, applied_at)
VALUES ('050_seed_tab_features.sql', NOW());
