package com.huangzj.server.web;

import com.huangzj.server.config.ClientTcpProperties;
import java.util.LinkedHashMap;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/** 给页面或脚本展示「客户端连区服」的 TCP 端口（帧格式：4 字节大端长度 + CmdRpcEnvelope）。 */
@RestController
@RequestMapping("/api/config")
@RequiredArgsConstructor
public class ClientTcpConfigController {

    private final ClientTcpProperties clientTcpProperties;

    @GetMapping("/client-tcp")
    public Map<String, Object> clientTcp() {
        Map<String, Object> m = new LinkedHashMap<>();
        m.put("port", clientTcpProperties.getPort());
        return m;
    }
}
