package com.sckw.system.controller.forkliftapp;

import com.sckw.core.web.response.BaseResult;
import com.sckw.system.model.vo.res.AppVersionsResVo;
import com.sckw.system.service.KwsAppVersionsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 系统版本管理Controller
 * @author chenxiaofei
 * @date 2026-01-07
 */
@RestController
@RequestMapping("/appVersions")
@Tag(name = "版本管理相关接口")
@RequiredArgsConstructor
public class AppVersionsController {

    private final KwsAppVersionsService kwsAppVersionsService;

    /**
     * 检查更新
     * @param platform 平台类型: 1-Android, 2-iOS
     * @return BaseResult
     */
    @GetMapping("/checkUpdate")
    @Operation(summary = "检查更新", description = "根据平台类型获取最新版本信息")
    public BaseResult<AppVersionsResVo> checkUpdate(@RequestParam Integer platform) {
        return BaseResult.success(kwsAppVersionsService.getLatestVersion(platform));
    }

}

