package com.gcsc.connection.global.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * SPA(React) fallback router
 *
 * React Router handles client-side routing,
 * so all frontend paths are forwarded to index.html.
 */
@Controller
public class WebViewController {

    @GetMapping("/")
    public String root() {
        return "redirect:/dashboard";
    }

    @GetMapping({"/dashboard", "/dashboard/**",
                 "/monitoring/**", "/statistics/**",
                 "/apikeys", "/apikeys/**",
                 "/admin/**",
                 "/api-hub", "/api-hub/**"})
    public String forward() {
        return "forward:/index.html";
    }
}
