import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";

export default defineConfig({
  plugins: [react()],
  server: {
    host: "0.0.0.0",
    port: 5174,
    proxy: {
      "/api/pcp-request": {
        target: "http://localhost:7005",
        changeOrigin: true,
        rewrite: (path: string) => path.replace(/^\/api\/pcp-request/, "")
      },
      "/api/pcp-ballistics": {
        target: "http://localhost:7003",
        changeOrigin: true,
        rewrite: (path: string) => path.replace(/^\/api\/pcp-ballistics/, "")
      },
      "/api/pcp-mission": {
        target: "http://localhost:7010",
        changeOrigin: true,
        rewrite: (path: string) => path.replace(/^\/api\/pcp-mission/, "")
      },
      "/api/stations": {
        target: "http://localhost:7009",
        changeOrigin: true
      },
      "/api": {
        target: "http://localhost:7008",
        changeOrigin: true
      }
    }
  },
  test: {
    environment: "jsdom",
    globals: true
  }
});
