SELECT
    [Id], [RunId], [TenantId], [WorkspaceId], [WorkspaceName], [Plan], [Status], [ReactivatedAt]
FROM [dbo].[DelinquentWorkspaceReactivationEvents]
WHERE (@TenantId IS NULL
   OR [TenantId] = @TenantId)
  AND (@From IS NULL
   OR [ReactivatedAt] >= @From)
  AND (@To IS NULL
   OR [ReactivatedAt] <= @To)
  AND (@Plan IS NULL
   OR [Plan] = @Plan)
  AND (@Status IS NULL
   OR [Status] = @Status)
ORDER BY [ReactivatedAt] DESC;
