package com.crunii.micro.service.sysmgr.controller;

import com.crunii.micro.common.dto.PageReq;
import com.crunii.micro.common.dto.PageRsp;
import com.crunii.micro.common.dto.Result;
import com.crunii.micro.domain.dto.Worker;
import com.crunii.micro.service.sysmgr.dto.post.PostPageReqVO;
import com.crunii.micro.service.sysmgr.dto.post.PostRespVO;
import com.crunii.micro.service.sysmgr.dto.sysmgr.*;
import com.crunii.micro.service.sysmgr.service.AccessService;
import com.crunii.micro.service.sysmgr.service.YcqAppVersionService;
import com.crunii.micro.web.mvc.CurrWorker;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @author baoxy
 * @date 2023-07-11
 */
@Api(tags = "接入管理")
@RestController
@RequestMapping("/public/YcqAppVersionController")
public class YcqAppVersionController {

    @Resource
    private YcqAppVersionService service;

    @ApiOperation(value = "获取最新的版本")
    @RequestMapping(path = "getMaxVersion", method = RequestMethod.POST)
    @ResponseBody
    public Result<YcqAppVersionVo> getMaxVersion() {
        return service.getMaxVersion();
    }

    @ApiOperation(value = "新增版本号")
    @RequestMapping(path = "create", method = RequestMethod.POST)
    @ResponseBody
    public Result<Object> create(@RequestBody YcqAppVersionDto dto) {
        return service.create(dto);
    }

    @ApiOperation(value = "修改版本号")
    @RequestMapping(path = "update", method = RequestMethod.POST)
    @ResponseBody
    public Result<Object> update(@RequestBody YcqAppVersionDto dto) {
        return service.update(dto);
    }

    @ApiOperation(value = "获取历史版本版本page")
    @RequestMapping(path = "getPageAppVersion", method = RequestMethod.POST)
    @ResponseBody
    public Result<PageRsp<YcqAppVersionVo>> getPageAppVersion(@RequestBody PageReq<YcqAppVersionDto> req) {
        return service.getPageAppVersion(req);
    }


    @ApiOperation(value = "获取历史版本版本List")
    @RequestMapping(path = "getListAppVersion", method = RequestMethod.POST)
    @ResponseBody
    public Result<List<YcqAppVersionVo>> getListAppVersion(@RequestBody YcqAppVersionDto dto) {
        return service.getListAppVersion(dto);
    }


    @ApiOperation(value = "删除")
    @RequestMapping(path = "/delete", method = RequestMethod.GET)
    @ResponseBody
    Result<Object> delete(@RequestParam("id") Long id) {
        return service.delete(id);
    };

}
