package com.ywt.alipaympapi.controller;

import com.ywt.model.PageVO;
import com.ywt.model.ResponseVO;
import com.ywt.request.register.CancelOrderRequest;
import com.ywt.request.register.OrderConfirmRequest;
import com.ywt.request.register.QueryOrderDetailRequest;
import com.ywt.request.register.QueryOrderListRequest;
import com.ywt.response.register.CancelOrderResponseData;
import com.ywt.response.register.OrderConfirmResponseData;
import com.ywt.response.register.QueryOrderDetailResponseData;
import com.ywt.response.register.QueryOrderListResponseData;
import com.ywt.alipaympapi.service.IsvRegisterService;
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;

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

    @Autowired
    private IsvRegisterService isvRegisterService;

    /**
     * 挂号确认
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.order.orderConfirm")
    public ResponseVO<OrderConfirmResponseData> orderConfirm(OrderConfirmRequest request) {

        return ResponseVO.success(isvRegisterService.orderConfirm(request));
    }

    /**
     * 预约单列表
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.order.orderList")
    public ResponseVO<PageVO<QueryOrderListResponseData>> queryOrderList(QueryOrderListRequest request) {
        PageVO<QueryOrderListResponseData> data = isvRegisterService.queryOrderList(request);


        return ResponseVO.success(data);

    }

    /**
     * 预约单详情
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.order.orderDetail")
    public ResponseVO<QueryOrderDetailResponseData> queryOrderDetail(QueryOrderDetailRequest request) {

        return ResponseVO.success(isvRegisterService.queryOrderDetail(request));
    }

    /**
     * 取消预约单
     *
     * @param request
     * @return
     */
    @PostMapping("isvRequest.order.cancelOrder")
    public ResponseVO<CancelOrderResponseData> cancelOrder(CancelOrderRequest request) throws Exception {

        return ResponseVO.success(isvRegisterService.cancelOrder(request));
    }
}
