config:
  target: "http://localhost:3002" # URL des Dispatch-Servers
  phases:
    - name: "0->50 in 10 min"
      duration: "10m"
      arrivalRate: 0
      rampTo: 50
    - name: "keep 50 for 20 min"
      duration: "20m"
      arrivalRate: 50
    - name: "50->0 in 10 min"
      duration: "10m"
      arrivalRate: 50
      rampTo: 0
  engines:
    socketio: {}
  socketio:
    transport: "websocket"
    query: "uid=c69741db-af39-499c-8367-8d2b38531b9c" # Beispiel UID, kann angepasst werden

scenarios:
  - engine: socketio
    flow:
      - emit:
          channel: "connect-pilot"
          data:
            logoffTime: "14:00"
            stationId: "1"
            debug: true
      - waitFor:
          event: "aircraft-update"
          timeout: 10000
          assign: "aircraftData"
      - log: "Empfangenes aircraft-update Event: {{ aircraftData }}"
      - function: |
          // In JavaScript kannst du jetzt die id extrahieren und in session speichern
          const aircraftData = JSON.parse(JSON.stringify(session.vars.aircraftData));
          session.vars.aircraftId = aircraftData.id;
          return session;
      - log: "Aircraft ID gespeichert: {{ aircraftId }}"
