package com.cool.store.controller.webc;

import com.cool.store.dto.ehr.StaffBaseInfoDTO;
import com.cool.store.request.IdRequest;
import com.cool.store.request.TempUserDetailRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.TempUserDetailService;
import com.cool.store.service.XfsgEhrService;
import com.cool.store.vo.TempUserDetailInfoVO;
import com.cool.store.vo.TempUserDetailListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author byd
 * @date 2024-04-29 16:15
 */
@RestController
@RequestMapping({"/mini/tempUserDetail"})
@Slf4j
@Api(tags = "培训登记")
public class TempUserDetailController {

    @Autowired
    private TempUserDetailService tempUserDetailService;

    @GetMapping(path = "/getUserList")
    @ApiOperation("登记员工列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shopId", value = "店铺Id")
    })
    public ResponseResult<TempUserDetailListVO> getUserList(@RequestParam(value = "shopId") Long shopId) {
        return ResponseResult.success(tempUserDetailService.userList(shopId));
    }

    @GetMapping(path = "/getUserInfoByIdCard")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "idCard", value = "身份证号")
    })
    @ApiOperation("培训登记-身份证号查询信息")
    public ResponseResult<StaffBaseInfoDTO> getUserInfoByIdCard(@RequestParam(value = "idCard") String idCard) {
        return ResponseResult.success(tempUserDetailService.getUserInfoByIdCard((idCard)));
    }

    @PostMapping(path = "/addTempUserDetail")
    @ApiOperation("培训登记-确认登记")
    public ResponseResult<Boolean> addTempUserDetail(@RequestBody TempUserDetailRequest tempUserDetailRequest) {
        tempUserDetailService.addTempUserDetail((tempUserDetailRequest));
        return ResponseResult.success(Boolean.TRUE);
    }

    @GetMapping(path = "/getUserInfoByIdUserDetailId")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userDetailId", value = "用户详情表id")
    })
    @ApiOperation("培训登记-查询信息根据用户详情id")
    public ResponseResult<TempUserDetailInfoVO> getUserInfoByIdUserDetailId(@RequestParam(value = "userDetailId") Long userDetailId) {
        return ResponseResult.success(tempUserDetailService.getUserInfoByIdUserDetailId((userDetailId)));
    }
}
