-- Check if the procedure exists, and create it only if it does not
DROP PROCEDURE IF EXISTS `seed_common_router_data`;

DELIMITER //

CREATE PROCEDURE seed_common_router_data()
BEGIN
    -- Insert Status Categories
    INSERT INTO status_category (name, description) 
    VALUES
        ('Network', 'Network related statuses'),
        ('Disk', 'Disk related statuses'),
        ('VPN', 'VPN connection statuses'),
        ('License', 'License statuses'),
        ('Container', 'Container related statuses')
    ON DUPLICATE KEY UPDATE id = id;

    -- Insert Status Types
    INSERT INTO status_type (category_id, name, code, description, severity) 
    VALUES
        (1, 'Online', 'NET_ONLINE', 'System is online', 1),
        (1, 'Offline', 'NET_OFFLINE', 'System is offline', 5),
        (2, 'Normal', 'DISK_NORMAL', 'Disk usage is normal', 1),
        (2, 'Warning', 'DISK_WARNING', 'Disk usage is high', 3),
        (2, 'Critical', 'DISK_CRITICAL', 'Disk usage is critical', 5),
        (3, 'Connected', 'VPN_CONNECTED', 'VPN is connected', 1),
        (3, 'Disconnected', 'VPN_DISCONNECTED', 'VPN is disconnected', 5),
        (5, 'Running', 'CONTAINER_RUNNING', 'Container is running', 1),
        (5, 'Stopped', 'CONTAINER_STOPPED', 'Container is stopped', 5)
    ON DUPLICATE KEY UPDATE id = id;

END //

DELIMITER ;
