-- Runtime configuration for each detection module: enabled flag, scoring weight
-- and optional per-module settings. Seeded from config/detection.php, then
-- edited via the admin panel (this table becomes the source of truth).
CREATE TABLE IF NOT EXISTS `module_configs` (
    `id`         BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    `module_key` VARCHAR(40)     NOT NULL,
    `label`      VARCHAR(120)    NOT NULL,
    `class`      VARCHAR(191)    NOT NULL,
    `group`      VARCHAR(20)     NOT NULL DEFAULT 'server',
    `enabled`    TINYINT(1)      NOT NULL DEFAULT 1,
    `weight`     DECIMAL(6,2)    NOT NULL DEFAULT 10.00,
    `settings`   JSON            NULL,
    `sort_order` INT             NOT NULL DEFAULT 0,
    `updated_at` DATETIME        NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uq_mc_key` (`module_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
