package shop.alien.store.controller;

import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import shop.alien.entity.result.R;
import shop.alien.entity.store.StoreAppVersion;
import shop.alien.store.service.StoreAppVersionService;

/**
 * App版本表 前端控制器
 *
 * @author ssk
 * @since 2025-01-07
 */
@Slf4j
@Api(tags = {"二期-App版本"})
@ApiSort(13)
@CrossOrigin
@RestController
@RequestMapping("/version")
@RequiredArgsConstructor
public class StoreAppVersionController {

    private final StoreAppVersionService storeAppVersionService;

    @ApiOperation("获取最新版本号")
    @ApiOperationSupport(order = 1)
    @ApiImplicitParams({@ApiImplicitParam(name = "appType", value = "app类型: 1:用户端, 2:商家端", dataType = "Integer", paramType = "query", required = true)})
    @GetMapping("/getLatestVersion")
    public R<StoreAppVersion> getAppealHistory(Integer appType) {
        return R.data(storeAppVersionService.getLatestVersion(appType));
    }

}
