import sys
import json
import time
import random

def main():
    if len(sys.argv) < 4:
        print("Usage: python tpf_execution.py <queue_id> <scenario_path> <task_id>")
        sys.exit(1)

    queue_id = sys.argv[1]
    scenario_path = sys.argv[2]
    task_id = sys.argv[3]

    print(f"Starting execution for Task: {task_id} in Queue: {queue_id}")
    print(f"Scenario: {scenario_path}")

    # Simulate work
    duration = random.randint(2, 5)
    time.sleep(duration)

    result = {
        "task_id": task_id,
        "status": "Success",
        "duration": duration,
        "details": f"Scenario {scenario_path} executed successfully."
    }

    print(json.dumps(result))

if __name__ == "__main__":
    main()
