-- Migration for demo data changes from CaseWallet to caseB
-- Apply these inserts to update the demo data

-- Update super admin name
UPDATE users SET full_name = 'Bhaskaran Chetty' WHERE full_name = 'Super Admin' AND is_superadmin = TRUE;

-- Add Vendor Management module
INSERT INTO modules (module_id, name, description) VALUES
    ('0194a8b2-0017-7123-8123-123456789abc'::uuid, 'Vendor Management', 'Vendor management module')
ON CONFLICT (module_id) DO NOTHING;

-- Enroll Vendor Management in dev program
INSERT INTO program_modules (program_id, module_id, config_json) VALUES
    ('0194a8b2-def0-7123-8123-123456789abc'::uuid, '0194a8b2-0017-7123-8123-123456789abc'::uuid, NULL)
ON CONFLICT DO NOTHING;

-- Demo customers for Cybex PTE LTD
INSERT INTO customers (
    customer_type, name, email, phone_number, address, tin, 
    risk_rating, compliance_status, balance, org_id, user_id, 
    isDeleted, updatedAt
) VALUES
    ('individual', 'John Smith', 'john.smith@email.com', '+679 123 4567', '123 Main Street, Suva, Fiji', '123456789', 'low', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('individual', 'Mary Johnson', 'mary.johnson@email.com', '+679 234 5678', '456 Queen Street, Suva, Fiji', '234567890', 'low', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('corporate', 'Pacific Traders Ltd', 'info@pacifictraders.com.fj', '+679 345 6789', '789 Kings Road, Suva, Fiji', '345678901', 'medium', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('corporate', 'Fiji Imports Ltd', 'sales@fijiimports.com.fj', '+679 456 7890', '321 Victoria Parade, Suva, Fiji', '456789012', 'medium', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('individual', 'Raj Kumar', 'raj.kumar@email.com', '+679 567 8901', '654 Princes Road, Suva, Fiji', '567890123', 'low', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('government', 'Ministry of Health', 'procurement@health.gov.fj', '+679 678 9012', 'Government Buildings, Suva, Fiji', '678901234', 'low', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('corporate', 'Suva Supermarket Ltd', 'manager@suvamarket.com.fj', '+679 789 0123', '987 Waimanu Road, Suva, Fiji', '789012345', 'medium', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('individual', 'Lisa Wong', 'lisa.wong@email.com', '+679 890 1234', '147 Gordon Street, Suva, Fiji', '890123456', 'low', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('corporate', 'Island Hardware Ltd', 'orders@islandhardware.com.fj', '+679 901 2345', '258 Thomson Street, Suva, Fiji', '901234567', 'medium', 'pending', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW()),
    ('individual', 'David Prasad', 'david.prasad@email.com', '+679 012 3456', '369 Loftus Street, Suva, Fiji', '012345678', 'low', 'compliant', 0.00, '0194a8b2-1234-7123-8123-123456789abc'::uuid, NULL, FALSE, NOW())
ON CONFLICT DO NOTHING;
