USE vault_display;

INSERT INTO screen_groups (group_key, name, type, mode, canvas_width, canvas_height)
VALUES ('matrix-wall', 'Front Four-Screen Matrix', 'matrix', 'individual', 3840, 2160)
ON DUPLICATE KEY UPDATE name = VALUES(name);

INSERT INTO playlists (id, name, description, type, is_active) VALUES
(1, 'Matrix Screen 1 - Pricing', 'Default pricing board for top-left matrix screen.', 'screen', 1),
(2, 'Matrix Screen 2 - Portfolio', 'Default portfolio board for top-right matrix screen.', 'screen', 1),
(3, 'Matrix Screen 3 - Signage and Branding', 'Default signage/branding board for bottom-left matrix screen.', 'screen', 1),
(4, 'Matrix Screen 4 - Offers and QR', 'Default offers/QR board for bottom-right matrix screen.', 'screen', 1),
(5, 'Counter Rolling Ads', 'Counter-facing customer advert reel.', 'screen', 1),
(6, 'Shop TV Rolling Ads', 'General shop TV advert reel.', 'screen', 1),
(7, 'Window Rolling Ads', 'Window-facing high-contrast advert reel.', 'screen', 1),
(8, 'Full Matrix Campaign', 'Full 3840x2160 wall campaign playlist.', 'matrix', 1),
(9, 'Emergency Notice', 'Emergency override playlist.', 'emergency', 1)
ON DUPLICATE KEY UPDATE name = VALUES(name), description = VALUES(description), type = VALUES(type), is_active = VALUES(is_active);

SET @matrix_group_id = (SELECT id FROM screen_groups WHERE group_key = 'matrix-wall' LIMIT 1);

INSERT INTO screens
(screen_key, name, type, role, group_id, position_x, position_y, width, height, orientation, assigned_playlist_id)
VALUES
('matrix-1', 'Matrix Top Left', 'matrix_member', 'pricing', @matrix_group_id, 0, 0, 1920, 1080, 'landscape', 1),
('matrix-2', 'Matrix Top Right', 'matrix_member', 'portfolio', @matrix_group_id, 1920, 0, 1920, 1080, 'landscape', 2),
('matrix-3', 'Matrix Bottom Left', 'matrix_member', 'signage_branding', @matrix_group_id, 0, 1080, 1920, 1080, 'landscape', 3),
('matrix-4', 'Matrix Bottom Right', 'matrix_member', 'offers_qr', @matrix_group_id, 1920, 1080, 1920, 1080, 'landscape', 4),
('counter', 'Counter Customer Screen', 'standalone', 'rolling_ads_counter', NULL, 0, 0, 1920, 1080, 'landscape', 5),
('tv', 'Shop TV', 'standalone', 'rolling_ads_tv', NULL, 0, 0, 1920, 1080, 'landscape', 6),
('window', 'Window Screen TV', 'standalone', 'rolling_ads_window', NULL, 0, 0, 1920, 1080, 'landscape', 7)
ON DUPLICATE KEY UPDATE
name = VALUES(name),
type = VALUES(type),
role = VALUES(role),
group_id = VALUES(group_id),
position_x = VALUES(position_x),
position_y = VALUES(position_y),
width = VALUES(width),
height = VALUES(height),
orientation = VALUES(orientation),
assigned_playlist_id = VALUES(assigned_playlist_id);
