package com.ywt.alipaympapi.controller;

import com.alibaba.fastjson.JSON;
import com.ywt.model.ResponseVO;
import com.ywt.request.nucleic.NucleicItemListRequest;
import com.ywt.request.nucleic.NucleicOrderConfirmRequest;
import com.ywt.request.nucleic.NucleicQuestionnaireRequest;
import com.ywt.request.nucleic.NucleicQuestionnaireResultRequest;
import com.ywt.request.nucleic.NucleicTimeListRequest;
import com.ywt.response.nucleic.NucleicItemResponseData;
import com.ywt.response.nucleic.NucleicOrderConfirmResponseData;
import com.ywt.response.nucleic.NucleicQuestionnaireResponseData;
import com.ywt.response.nucleic.NucleicQuestionnaireResultResponseData;
import com.ywt.response.nucleic.NucleicTimeListResponseData;
import com.ywt.alipaympapi.service.NucleicService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Desc
 */
@Slf4j
@RestController
public class NucleicController {

    @Autowired
    private NucleicService nucleicService;

    /**
     * 核酸检测项目列表
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.nucleic.itemList")
    public ResponseVO<List<NucleicItemResponseData>> itemList(NucleicItemListRequest request) {
        log.info("request:{}", JSON.toJSONString(request));
        return ResponseVO.success(nucleicService.itemList(request));
    }

    /**
     * 检查时间列表
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.nucleic.testTimeList")
    public ResponseVO<NucleicTimeListResponseData> testTimeList(NucleicTimeListRequest request) {
        log.info("request:{}", JSON.toJSONString(request));
        return ResponseVO.success(nucleicService.testTimeList(request));
    }

    /**
     * 流行病学问卷题目
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.nucleic.questionnaire")
    public ResponseVO<NucleicQuestionnaireResponseData> questionnaire(NucleicQuestionnaireRequest request) {
        log.info("request:{}", JSON.toJSONString(request));
        return ResponseVO.success(nucleicService.questionnaire(request));
    }

    /**
     * 流行病学问卷回执
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.nucleic.questionnaireResult")
    public ResponseVO<NucleicQuestionnaireResultResponseData> questionnaireResult(NucleicQuestionnaireResultRequest request) {
        log.info("request:{}", JSON.toJSONString(request));
        return ResponseVO.success(nucleicService.questionnaireResult(request));
    }

    /**
     * 核酸预约确认
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.nucleic.orderConfirm")
    public ResponseVO<NucleicOrderConfirmResponseData> orderConfirm(NucleicOrderConfirmRequest request) {
        log.info("request:{}", JSON.toJSONString(request));
        return ResponseVO.success(nucleicService.orderConfirm(request));
    }
}