package com.example.scaffold.controller;

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

import java.util.Map;

@Controller
public class RootController {
    
    @GetMapping("/")
    public String index() {
        return "forward:/index.html";
    }
    
    @GetMapping("/api/status")
    @ResponseBody
    public Map<String, Object> status() {
        return Map.of(
            "message", "Spring Boot 学习脚手架运行中",
            "pages", Map.of(
                "首页", "/index.html",
                "IoC学习", "/ioc.html",
                "AOP学习", "/aop.html",
                "MyBatis学习", "/mybatis.html",
                "事务学习", "/transaction.html",
                "用户管理", "/users.html",
                "API测试", "/api.html"
            ),
            "apis", Map.of(
                "用户API", "/api/users",
                "产品API", "/api/products",
                "订单API", "/api/orders",
                "学习API", "/api/learning"
            )
        );
    }
}
