package com.cusc.nirvana.user.rnr.fp.controller;

import com.cusc.nirvana.common.result.Response;
import com.cusc.nirvana.user.rnr.fp.dto.FpRnrSmsInfoDTO;
import com.cusc.nirvana.user.rnr.fp.dto.FpSendMessageDTO;
import com.cusc.nirvana.user.rnr.fp.dto.FpVehicleCardRnrDTO;
import com.cusc.nirvana.user.rnr.fp.dto.UnbindReceiceSMSDTO;
import com.cusc.nirvana.user.rnr.fp.service.IFpCardUnBindService;
import com.cusc.nirvana.user.rnr.mg.dto.MgRnrCardInfoDTO;
import com.cusc.nirvana.user.rnr.mg.dto.MgRnrInfoDTO;
import com.cusc.nirvana.user.rnr.mg.dto.RnrOrderDTO;
import com.cusc.nirvana.user.rnr.mg.dto.RnrRelationDTO;
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 javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/card/Unbind")
public class FpCardUnBindController {

    @Resource
    private IFpCardUnBindService cardUnBindService;

    //解绑
    @PostMapping("/ownerUnbind")
    public Response<Boolean> ownerUnbind(@RequestBody RnrRelationDTO relationDTO) {
        return cardUnBindService.ownerUnbind(relationDTO);
    }

    //获取人的信息
    @PostMapping("/getUserInfo")
    public Response<MgRnrInfoDTO> getUserInfo(@RequestBody FpVehicleCardRnrDTO cardRnrDTO) {
        return cardUnBindService.getUserInfo(cardRnrDTO);
    }

    //发送短信
    @PostMapping("/sendMessage")
    public Response<FpRnrSmsInfoDTO> sendUnbindSMS(@RequestBody FpSendMessageDTO sendMessageDTO) {
        return cardUnBindService.sendUnbindSMS(sendMessageDTO);
    }

    //根据vin获取cardlist
    @PostMapping("/getCardList")
    public Response<List<MgRnrCardInfoDTO>> getCardList(@RequestBody FpVehicleCardRnrDTO rnrDTO) {
        return cardUnBindService.getCardList(rnrDTO);
    }

    //短信回调
    @PostMapping("/receiverMessage")
    public Response<FpRnrSmsInfoDTO> receiverMessage(@RequestBody UnbindReceiceSMSDTO receiceSMSDTO) {
        return cardUnBindService.receiveMessage(receiceSMSDTO);
    }


    //查询状态
    @PostMapping("/getMessageStatus")
    public Response<RnrOrderDTO> getMessageStatus(@RequestBody FpRnrSmsInfoDTO bean) {
        return cardUnBindService.getMessageStatus(bean);
    }

    //查询状态
    @PostMapping("/getOrderStatus")
    public Response<RnrOrderDTO> getOrderStatus(@RequestBody RnrOrderDTO bean) {
        return cardUnBindService.getOrderStatus(bean);
    }

    //插入工单信息
    @PostMapping("/insertOrder")
    public Response<RnrOrderDTO> insertOrder(@RequestBody RnrOrderDTO bean) {
        return cardUnBindService.insertOrder(bean);
    }

    //插入工单信息
    @PostMapping("/updateOrder")
    public Response<RnrOrderDTO> updateOrder(@RequestBody RnrOrderDTO bean) {
        return cardUnBindService.updateOrder(bean);
    }

    //校验短信超时
    @PostMapping("/checkMSMtime")
    public Response checkReceiveMessageTime(@RequestBody RnrOrderDTO dto){
        return cardUnBindService.checkReceiveMessageTime(dto);
    }

}
