package com.red.circle.other.adapter.app.sys;

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.clientobject.sys.VersionManageCO;
import com.red.circle.other.app.dto.clientobject.sys.VersionManageLatestAndReviewCO;
import com.red.circle.other.app.service.sys.SysAppVersionManageService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * app版本管理 前端控制器
 * </p>
 *
 * @author pengliang
 * @eo.api-type http
 * @eo.groupName 系统服务.App版本管理
 * @eo.path /sys/version/manage
 * @since 2019-11-12
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/sys/version/manage", produces = MediaType.APPLICATION_JSON_VALUE)
public class VersionManageRestController extends BaseController {

  private final SysAppVersionManageService sysAppVersionManageService;

  /**
   * 获取最新版本版本.
   *
   * @eo.name 获取最新版本版本.
   * @eo.url /release/latest
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/release/latest")
  public VersionManageCO getLatestVersionManage(AppExtCommand cmd) {
    return sysAppVersionManageService.getLatestVersionManage(cmd);
  }

  /**
   * 获取最新及正在审核版本.
   *
   * @eo.name 获取最新及正在审核版本.
   * @eo.url /latest/review
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/latest/review")
  public VersionManageLatestAndReviewCO getLatestAndReviewVersionManage(AppExtCommand cmd) {
    return sysAppVersionManageService.getVersionManageLatestAndReview(cmd);
  }

}
