package com.ximai.web.controller.api;

import com.ximai.common.core.controller.BaseController;
import com.ximai.common.core.domain.AjaxResult;
import com.ximai.web.service.BuildVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 开放接口：查询当前部署包的 Git 构建版本（无需登录，见 SecurityConfig /api/**）
 */
@Api("开放接口-构建版本")
@RestController
@RequestMapping("/api/build")
public class OpenBuildVersionController extends BaseController {

    @Autowired
    private BuildVersionService buildVersionService;

    @ApiOperation("查询 Git 打包版本信息")
    @GetMapping("/version")
    public AjaxResult getVersion() {
        return AjaxResult.success(buildVersionService.getGitBuildVersion());
    }
}
