package com.neusoft.smart.pos.payorder.controller;

import com.neusoft.smart.pos.dto.payorder.request.*;
import com.neusoft.smart.pos.dto.payorder.response.*;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import com.neusoft.smart.pos.payorder.service.PayOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Api(value = "支付订单管理使用接口", description = "支付订单管理使用接口")
@RestController
@RequestMapping(path = "/payorder")
@Validated
public class PayOrderController {

    @Autowired
    private PayOrderService payOrderService;// = ServiceFactory.getOrderServiceInstance(null,null);

    @ApiOperation(value = "支付订单生成使用接口", notes = "支付订单生成使用方法")
    @PostMapping("/createPayOrder")
    public ResponseData<PostPayOrderResponse> createPayOrder(@RequestBody PostCreatePayOrderRequest createOrderRequest) {
        return new ResponseData<>(payOrderService.createPayOrder(createOrderRequest));
    }

//    @ApiOperation(value = "订单保存使用接口", notes = "根据订单编号更新订单信息方法")
//    @PostMapping("/saveOrder")
//    public ResponseData<PostOrderResponse> saveOrder(@RequestBody PostSaveOrderRequest saveOrderRequest) {
//        return null;//new ResponseData<>(orderService.saveOrder(saveOrderRequest));
//    }
//
//    @ApiOperation(value = "订单取消使用接口", notes = "根据订单编号设置订单状态为已取消的方法")
//    @PutMapping("/cancleOrder")
//    public ResponseData<PutCancelOrderResponse> cancleOrder(@RequestBody PutCancelOrderRequest cancleOrderRequest) {
//        return null;//new ResponseData<>(orderService.cancleOrder(cancleOrderRequest));
//    }
//
//    @ApiOperation(value = "更新订单状态接口", notes = "根据订单编号计算并更新订单状态方法")
//    @PutMapping("/updateOrderStatus")
//    public ResponseData<PutUpdateOrderStatusResponse> updateOrderStatus(@Valid @RequestBody PutUpdateOrderStatusRequest updateOrderStatusRequest, BindingResult bindingResult) {
//        return null;//new ResponseData<>(orderService.updateOrderStatus(updateOrderStatusRequest));
//    }
//    //setOrderStatus
//    @ApiOperation(value = "设置订单状态接口", notes = "根据订单编号设置订单状态方法")
//    @PutMapping("/setOrderStatus")
//    public ResponseData<PutSetOrderStatusResponse> setOrderStatus(@Valid @RequestBody PutSetOrderStatusRequest setOrderStatusRequest, BindingResult bindingResult) {
//        return null;//new ResponseData<>(orderService.setOrderStatus(setOrderStatusRequest));
//    }
//
//    @ApiOperation(value = "订单信息查询接口", notes = "根据订单编号查询订单信息方法")
//    @GetMapping("/getOrderInfo")
//    public ResponseData<GetAllOrderInfoResponse> getOrderInfo(@RequestParam(value="orderNumber",defaultValue = "") String orderNumber) {
//        return null;//new ResponseData<>(orderService.getOrderInfoByOrderNumber(orderNumber));
//    }
//
////    @ApiOperation(value = "订单商品信息列表查询接口", notes = "订单信息商品信息列表查询方法")
////    @GetMapping("/getOrderGoodsList")
////    public ResponseData<GetOrderInfoResponse> getOrderGoodsList(@RequestParam(value="orderNumber",defaultValue = "") String orderNumber) {
////        return new ResponseData<>(orderService.getOrderGoodsListByOrderNumber(orderNumber));
////    }
//
//    //doPay
//    @ApiOperation(value = "订单支付使用接口", notes = "开启订单支付流程的方法")
//    @PostMapping("/doPay")
//    public ResponseData<PostDoPayOrderResponse> doPay(@RequestBody PostDoPayOrderRequest doPayOrderRequest) {
//        return null;//new ResponseData<>(orderService.doPay(doPayOrderRequest));
//    }
}
