-- Insert demo biometric device
-- Date: 2025-11-18
-- Description: Add F500 biometric device for FRCS demo

-- Insert the demo F500 device
INSERT INTO biometric_devices (
    biometric_device_id,
    device_sn,
    device_type,
    name,
    description,
    branch_id,
    org_id,
    approved,
    is_online
) VALUES (
    '62b9b561-f13e-4e41-91ed-3a9b43529777'::uuid,
    'EB202509065',
    'F500',
    'Demo Device',
    'F500 biometric device for FRCS Time & Attendance demo',
    '019a9524-320c-7b14-9a28-9ae6298e756d'::uuid,  -- Branch ID
    '0194a8b2-1234-7123-8123-123456789abc'::uuid,  -- Cybex/FRCS org
    TRUE,
    FALSE
)
ON CONFLICT (biometric_device_id) DO UPDATE
SET
    device_sn = EXCLUDED.device_sn,
    device_type = EXCLUDED.device_type,
    name = EXCLUDED.name,
    description = EXCLUDED.description,
    branch_id = EXCLUDED.branch_id,
    org_id = EXCLUDED.org_id,
    approved = EXCLUDED.approved,
    updatedAt = NOW();

-- Verify the insert
SELECT 
    biometric_device_id,
    device_sn,
    device_type,
    name,
    branch_id,
    org_id,
    approved,
    is_online
FROM biometric_devices
WHERE device_sn = 'EB202509065';
