package com.zt.plat.module.qms.business.bus.controller.admin;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.zt.plat.framework.common.pojo.CommonResult.success;

import java.util.List;

import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignManualParam;
import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignMethodParam;
import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignSampleParam;
import com.zt.plat.module.qms.business.bus.service.SampleTaskAssignService;
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;

@Tag(name = "管理后台 - 样品任务分配")
@RestController
@RequestMapping("/qms/bus/sample/task-assign")
@Validated
public class SampleTaskAssignController {
	
	@Resource
	private SampleTaskAssignService sampleTaskAssignService;
	
	@Operation(description = "获取分配人员列表")
	@GetMapping("/getAssignUserList")
	public CommonResult<?> getAssignUserList() {
		List<AdminUserRespDTO> list = sampleTaskAssignService.getAssignUserList();
		return success(list);
	}

    @PostMapping("/changeMethod")
    public CommonResult<?> changeMethod() {
    	
    	
    	return success("成功");
    }
	
    @PostMapping("/methodAssign")
    public CommonResult<?> methodAssign(@RequestBody SampleTaskAssignMethodParam param) {
    	sampleTaskAssignService.methodAssign(param);
    	return success("成功");
    }

    @PostMapping("/manualAssign")
    public CommonResult<?> manualAssign(@RequestBody SampleTaskAssignManualParam param) {
    	sampleTaskAssignService.manualAssign(param);
    	return success("成功");    	
    }
	
    @PostMapping("/sampleAssign")
    public CommonResult<?> sampleAssign(@RequestBody SampleTaskAssignSampleParam param) {
    	sampleTaskAssignService.sampleAssign(param);
    	return success("成功");
    }
    
    @PostMapping("/submitAssign")
    public CommonResult<?> submitAssign(Long id) {
    	sampleTaskAssignService.submitAssign(id);
    	return success("成功");
    }
    
    @PostMapping("/voidAssign")
    public CommonResult<?> voidAssign(Long id) {
    	sampleTaskAssignService.voidAssign(id);
    	return success("成功");
    }

}
