/**
 * Phase-0-Baseline: parallele GET /health (kein Auth).
 * BASE_URL optional, z. B. https://dev.shinkan.jinkendo.de
 */
import http from 'k6/http'
import { check } from 'k6'

export const options = {
  scenarios: {
    health: {
      executor: 'constant-vus',
      vus: 10,
      duration: '30s',
      gracefulStop: '5s',
      tags: { scenario: 'health' },
      exec: 'health',
    },
  },
  thresholds: {
    http_req_failed: ['rate<0.05'],
    'http_req_duration{scenario:health}': ['p(95)<3000'],
  },
}

const BASE = (__ENV.BASE_URL || 'https://dev.shinkan.jinkendo.de').replace(/\/$/, '')

export function health() {
  const res = http.get(`${BASE}/health`, { tags: { scenario: 'health' } })
  check(res, {
    'health 2xx': (r) => r.status >= 200 && r.status < 300,
  })
}
