package org.jeecg.modules.api.travelController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.apiBean.PageBean;
import org.jeecg.modules.apiService.IndexApiService;
import org.jeecg.modules.apiService.OrderApiService;
import org.jeecg.modules.travelOrder.entity.TravelOrder;
import org.jeecg.modules.travelTime.entity.TravelTime;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags="小程序-订单相关接口")
@RestController
@RequestMapping("/api/order")
@Slf4j
public class OrderApiController {
    //订单相关接口
    @Resource
    private OrderApiService orderApiService;

    @Resource
    private IndexApiService indexApiService;

    //时间段查询
    @ApiOperation(value="小程序-查询预约时间段", notes="小程序-查询预约时间段")
    @RequestMapping(value = "/queryOrderTime", method = {RequestMethod.GET})
    public Result<?> queryOrderTime(TravelTime travelTime){
        return indexApiService.queryOrderTime(travelTime);
    }

    //查询订单信息
    @ApiOperation(value="小程序-查询预约订单列表", notes="小程序-查询预约订单列表")
    @RequestMapping(value = "/queryOrderList", method = {RequestMethod.GET})
    public Result<?> queryOrderList(TravelOrder travelOrder, PageBean pageBean){
        return indexApiService.queryOrderList(travelOrder, pageBean);
    }

    //创建订单
    @ApiOperation(value = "创建订单",notes = "创建订单")
    @PostMapping("/createOrder")
    public Result<?> createOrder(){
        return orderApiService.createOrder();
    }

    //立即支付
    @ApiOperation(value = "立即支付",notes = "立即支付")
    @PostMapping("/payOrder")
    public Result<?> payOrder(){
        return orderApiService.payOrder();
    }
}
