package cn.reghao.tnb.admin.controller;

import cn.reghao.tnb.admin.model.vo.RouteDefinitionInfo;
import cn.reghao.tnb.admin.service.RouteService;
import cn.reghao.tnb.common.web.WebResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author reghao
 * @date 2025-04-16 10:37:14
 */
@Tag(name = "tnb 网关接口")
@RestController
@RequestMapping("/api/admin1/tnb/gw")
public class TnbGatewayController {
    private final RouteService routeService;

    public TnbGatewayController(RouteService routeService) {
        this.routeService = routeService;
    }

    @Operation(summary = "网关路由")
    @GetMapping("/route")
    public String gatewayRoutePage() {
        List<RouteDefinitionInfo> routes = routeService.getRouteInfos();
        return WebResult.success(routes);
    }
}
