package digital.laboratory.platform.entrustment.controller;

import cn.hutool.json.JSONObject;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.security.annotation.Inner;
import digital.laboratory.platform.entrustment.service.PushDataToLabsCareService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ChenJiangBao
 * @version 1.0
 * @description: 推送数据到LabsCare平台接口管理
 * @date 2025/4/3 10:48
 */
//@RestController
@RequestMapping("/pushDataToLabsCare")
@Api(tags = "19-推送数据到LabsCare平台接口管理", description = "推送数据到LabsCare平台接口管理")
public class PushDataToLabsCareController {



    @Resource
    private PushDataToLabsCareService pushDataToLabsCareService;

    @ApiOperation("获取推送鉴定委托书的数据")
    @PostMapping("/entrustLetter")
    @Inner(value = false)
    public R<JSONObject> entrustLetter(@RequestParam("entrustId") String entrustId) {
        try {
            return R.ok(pushDataToLabsCareService.fetchEntrustLetterData(entrustId));
        } catch (Exception e) {
            return R.failed(e.getMessage());
        }
    }

    @ApiOperation("获取推送鉴定事项确认书的数据")
    @PostMapping("/itemConfirmLetter")
    @Inner(value = false)
    public R<JSONObject> itemConfirmLetter(@RequestParam("entrustId") String entrustId) {
        try {
            return R.ok(pushDataToLabsCareService.fetchItemConfirmLetterData(entrustId));
        } catch (Exception e) {
            return R.failed(e.getMessage());
        }
    }

}
