package com.ktg.iscs.controller;

import com.ktg.common.core.controller.BaseController;
import com.ktg.common.pojo.CommonResult;
import com.ktg.iscs.domain.dto.step.IsJobTicketStepDTO;
import com.ktg.iscs.domain.dto.ticket.AddJobTicketDTO;
import com.ktg.iscs.domain.vo.hardwareApi.JobTicketVO;
import com.ktg.iscs.domain.vo.step.IsJobTicketStepVO;
import com.ktg.iscs.service.IIsJobTicketStepService;
import com.ktg.iscs.service.IIsJobTicketUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

/**
 * 作业票执行步骤Controller
 *
 * @author cgj
 * @date 2024-12-23
 */
@Api(tags = "作业票执行步骤")
@RestController
@RequestMapping("/iscs/step")
public class IsJobTicketStepController extends BaseController {

    @Autowired
    private IIsJobTicketStepService isJobTicketStepService;
    @Autowired
    private IIsJobTicketUserService iIsJobTicketUserService;
    @Autowired
    private IIsJobTicketStepService iIsJobTicketStepService;

    @ApiOperation("八大步骤执行")
    @PostMapping("/updateJobStep")
    public CommonResult<Boolean> updateJobStep(@RequestBody @Valid IsJobTicketStepDTO dto) {
        return CommonResult.success(isJobTicketStepService.updateJobStep(dto));
    }

    @ApiOperation("第三步骤-新增人员")
    @PostMapping("/addJobUsers")
    public CommonResult<Boolean> addJobUsers(@RequestBody @Valid AddJobTicketDTO dto) {
        return CommonResult.success(iIsJobTicketUserService.addJobUsers(dto));
    }

    @ApiOperation("获取八大步骤详细")
    @Parameter(name = "ticketId", description = "ticketId")
    @GetMapping(value = "/selectStepsByTicketId")
    public CommonResult<List<IsJobTicketStepVO>> selectStepsByTicketId(Long ticketId) {
        return CommonResult.success(iIsJobTicketStepService.selectStepsByTicketId(ticketId));
    }

    @ApiOperation("获取第八大步骤-查看")
    @Parameter(name = "stepId", description = "stepId")
    @GetMapping(value = "/getStepEight")
    public CommonResult<List<JobTicketVO>> getStepEight(Long ticketId) {
        return CommonResult.success(iIsJobTicketStepService.getStepEight(ticketId));
    }


}
