-- SAKEN Platform Phase 4.4 Sidebar Sections Sections - No Payroll
-- Run in Cloudflare D1 Console: saken_platform_db

INSERT INTO permissions (user_id, section_key, can_view, can_refresh, can_manage) VALUES
(1, 'customers', 1, 1, 0),
(1, 'budget', 1, 0, 0),
(1, 'business_profitability', 1, 0, 0),
(1, 'other_revenue_dashboard', 1, 0, 0),
(1, 'restaurant_results_dashboard', 1, 0, 0),
(1, 'contracts', 1, 0, 0),
(1, 'cashflow', 1, 0, 0),
(1, 'users', 1, 0, 1),
(1, 'settings', 1, 0, 1),
(1, 'section_builder', 1, 0, 1)
ON CONFLICT(user_id, section_key)
DO UPDATE SET can_view = excluded.can_view, can_refresh = excluded.can_refresh, can_manage = excluded.can_manage;

SELECT * FROM permissions WHERE user_id = 1 ORDER BY section_key;
