package cn.reghao.autodop.dmaster.app.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import cn.reghao.jdkutil.result.WebBody;

/**
 * @author reghao
 * @date 2019-08-30 18:49:15
 */
@Slf4j
@Api(tags = "应用构建部署日志接口")
@RestController
@RequestMapping("/api/app/bd")
public class BuildDeployLogController {
    @ApiOperation(value = "代码日志")
    @GetMapping("/log/commit")
    public ResponseEntity<String> commitLogs(@RequestParam("page") int page, @RequestParam("size") int size,
                                             @RequestParam("env") String env) {
        return ResponseEntity.ok().body("");
    }

    @ApiOperation(value = "某个应用的代码日志")
    @GetMapping("/log/commit/{appId}")
    public ResponseEntity<String> commitLogsByApp(@RequestParam("page") int page, @RequestParam("size") int size,
                                                  @PathVariable("appId") String appId) {
        return ResponseEntity.ok().body(WebBody.success(""));
    }

    @ApiOperation(value = "构建日志")
    @GetMapping("/log/build")
    public ResponseEntity<String> buildLogs(@RequestParam("page") int page, @RequestParam("size") int size,
                                            @RequestParam("env") String env) {
        return ResponseEntity.ok().body(WebBody.success("pageList"));
    }

    @ApiOperation(value = "某个应用的构建日志")
    @GetMapping("/log/build/{appId}")
    public ResponseEntity<String> buildLogsByApp(@PathVariable("appId") String appId,
                                                 @RequestParam("page") int page,
                                                 @RequestParam("size") int size) {
        return ResponseEntity.ok().body(WebBody.success("pageList"));
    }

    @ApiOperation(value = "部署日志")
    @GetMapping("/log/deploy")
    public ResponseEntity<String> deployLogs(@RequestParam("page") int page, @RequestParam("size") int size,
                                             @RequestParam("env") String env) {
        return ResponseEntity.ok().body(WebBody.success("pageList"));
    }

    @ApiOperation(value = "某个应用的部署日志")
    @GetMapping("/log/deploy/{appId}")
    public ResponseEntity<String> deployLogsByApp(@RequestParam("page") int page, @RequestParam("size") int size,
                                                  @PathVariable("appId") String appId) {
        return ResponseEntity.ok().body(WebBody.success("pageList"));
    }
}
