-- @query import_completion_counts
-- @db importDrive 1.0
-- @param enumeration_id TEXT
SELECT
    COUNT(CASE WHEN Status != 3 THEN 1 END) as total,
    SUM(CASE WHEN Status = 1 THEN 1 ELSE 0 END) as imported,
    SUM(CASE WHEN Status = 2 THEN 1 ELSE 0 END) as failed
FROM importDrive.EnumerationContents
WHERE EnumerationID = ?enumeration_id
  AND IsDirectory = 0
