Given a list of tasks, each represented by a tuple (task_id, duration, dependencies) where task_id is a unique identifier, duration is the time required to complete the task, and dependencies is a list of task IDs that must be completed before this task, determine the minimum time required to complete all tasks.
You may assume that all tasks can be completed and there are no circular dependencies.
Example 1:
Input: tasks = [(1, 3, []), (2, 2, [1]), (3, 1, [1, 2])]
Output: 6
Explanation: Task 1 takes 3 units of time, task 2 takes 2 units (after task 1), and task 3 takes 1 unit (after tasks 1 and 2). Total = 3 + 2 + 1 = 6.
Example 2:
Input: tasks = [(1, 5, []), (2, 3, [1]), (3, 2, [1, 2]), (4, 1, [3])]
Output: 11
Explanation: The completion order is task 1 (5) -> task 2 (3) -> task 3 (2) -> task 4 (1). Total = 5 + 3 + 2 + 1 = 11.
1 <= tasks.length <= 10^40 <= duration <= 1000