-- ============================================================================
-- Phase 8: Inventory Analytics Modules Registration (UPDATED with proper UUID v7)
-- Purpose: Register declarative modules for inventory analytics dashboards
-- Pattern: Follows procurement analytics module pattern with data-controller
-- ============================================================================

-- Delete old Phase 8 modules if they exist (cleanup)
DELETE FROM modules WHERE module_id::text LIKE '01948801-%';

-- Module IDs for Phase 8 Inventory Analytics (proper UUID v7)
-- Generated: 2025-10-25
INSERT INTO modules (module_id, name, description) VALUES
    ('019a17e0-d2fa-79f8-b4e8-ff29f7041ef9'::uuid, 'VAT Analytics Dashboard', 'VAT summary and reconciliation analytics'),
    ('019a17e0-d2fa-7e1e-aa3c-f05811135cea'::uuid, 'Product Movement Analytics', 'Product sales and inventory movement analytics'),
    ('019a17e0-d2fa-7895-958d-5695eef8bd22'::uuid, 'Payment Methods Analytics', 'Payment method breakdown and credit analysis'),
    ('019a17e0-d2fa-7d7c-800b-8d3e6663cc21'::uuid, 'Customer Analytics Dashboard', 'Customer purchase patterns and revenue analytics'),
    ('019a17e0-d2fa-7297-9f71-caad9591440f'::uuid, 'Staff Performance Analytics', 'Cashier sales and efficiency metrics'),
    ('019a17e0-d2fa-71fa-b181-1b8f63938f8c'::uuid, 'Branch Performance Dashboard', 'Branch-level sales comparison and trends'),
    ('019a17e0-d2fa-7b4b-80ea-e5a1c19a1547'::uuid, 'Sales Time-Series Analytics', 'Daily, hourly, and trend analytics'),
    ('019a17e0-d2fa-784e-9c46-c11673302dad'::uuid, 'Profit & Margin Analytics', 'Product profitability and discount impact'),
    ('019a17e0-d2fa-7683-9f53-e42fdc4ba7b5'::uuid, 'Customer Segmentation (RFM)', 'RFM analysis and customer lifecycle'),
    ('019a17e0-d2fa-7646-86e4-54a8fd912321'::uuid, 'Transaction Export Dashboard', 'Full transaction data export and reporting'),
    ('019a17e0-d2fa-71d6-8d0e-0ac55529dd2f'::uuid, 'Top 10 Best Sellers', 'Top 10 best-selling products by volume'),
    ('019a17e0-d2fa-791e-a032-c0705df59671'::uuid, 'Slow Moving Items', 'Products with low or no recent sales activity'),
    ('019a17e0-d2fa-714b-a09d-adc83def3745'::uuid, 'VAT Summary Report', 'Comprehensive VAT report showing 0% and 12.5% breakdown')
ON CONFLICT (module_id) DO NOTHING;

-- Note: Full module configs will be inserted below
-- This initial insert reserves the UUIDs and names

COMMENT ON TABLE modules IS 'Module registry - Phase 8 adds 13 inventory analytics modules with proper UUID v7 IDs';
