package com.bocloud.ims.booter.controller.installation;

import com.bocloud.cmp.model.installation.InstallResultBeans;
import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.GridBean;
import com.bocloud.common.model.Pager;
import com.bocloud.common.utils.Common;
import com.bocloud.ims.entity.installation.InstallTask;
import com.bocloud.ims.interfaces.installation.InstallTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 物理装机任务历史Controller
 **/
@RestController
@RequestMapping("/v1/installations")
@Api(value = "装机任务管理", tags = "装机任务管理")
public class InstallationController {
    @Autowired
    private InstallTaskService taskService;

    /**
     * 分页查询装机任务历史
     *
     * @param pager
     * @return
     */
    @GetMapping
    @Log(module = BoCloudService.IMS, target = "装机任务", operation = "分页查询装机任务历史")
    @ApiOperation(tags = {"CMC", "CSC"}, value = "分页查询装机任务历史",  httpMethod = "GET")
    public BocloudResult<GridBean<InstallTask>> list(Pager pager) {
        return taskService.list(pager);
    }

    /**
     * 查询任务历史详细
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/{id}")
    @Log(module = BoCloudService.IMS, target = "装机任务", operation = "查询任务历史详细")
    @ApiOperation(tags = {"CMC", "CSC"}, value = "查询指定装机任务详情",  httpMethod = "GET")
    public BocloudResult<InstallResultBeans> detail(@PathVariable(value = Common.ID) Long id) {
        return taskService.detail(id);
    }
}
