-- @query video_content_resolve
-- @db media 11.0
-- @param item_ids TEXT
SELECT
    requested.driveItemId,
    COALESCE(pending.sourceDriveItemId, requested.driveItemId) AS videoContentDriveItemId
FROM (
    SELECT value AS driveItemId
    FROM json_each(?item_ids)
) AS requested
LEFT JOIN media.media_pending_items AS pending
    ON pending.tempDriveItemId = requested.driveItemId
