package com.sqx.modules.bl.order.app;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.artificer.entity.Orders;
import com.sqx.modules.bl.order.entity.UserPackageOrder;
import com.sqx.modules.bl.order.service.UserPackageOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/app/user/package/order")
@Api(value = "用户购买服务包订单管理", tags = {"用户购买服务包订单"})
public class AppUserPackageOrderController {

    @Autowired
    private UserPackageOrderService service;

    @Login
    @PostMapping("/insertOrders")
    @ApiOperation("添加订单")
    public Result insertOrders(@RequestBody UserPackageOrder userPackageOrder){
        //入参：用户ID，代金券IDS，原总金额，应付总金额，会员优惠比，
        return service.insertOrders(userPackageOrder);
    }

    @Login
    @PostMapping("/payOrder")
    @ApiOperation("钱包支付订单")
    public Result payOrder(Long ordersId){
        //入参：ordersId
        return service.payOrder(ordersId);
    }

    @Login
    @PostMapping("/findUserPackageOrders")
    @ApiOperation("查询服务包订单")
    public Result findUserPackageOrders(@RequestBody UserPackageOrder userPackageOrder){
        //入参：用户ID
        return service.findUserPackageOrders(userPackageOrder);
    }

    @Login
    @PostMapping("/selectOrdersDetails")
    @ApiOperation("获取订单详情")
    public Result selectOrdersDetails(Long ordersId){
        //入参：ordersId
        return service.selectOrdersDetails(ordersId);
    }

    @Login
    @PostMapping("/insertGroupOrders")
    @ApiOperation("添加团购订单")
    public Result insertGroupOrders(@RequestBody UserPackageOrder userPackageOrder){
        //入参：用户ID，代金券IDS，会员优惠比，团号，开始时间，结束时间，是否只限新用户
        return service.insertGroupOrders(userPackageOrder);
    }

    @Login
    @PostMapping("/payGroupOrders")
    @ApiOperation("支付团购订单")
    public Result payGroupOrders(Long ordersId){
        //入参：用户ID，代金券IDS，会员优惠比，团号，
        return service.payGroupOrders(ordersId);
    }

    @Login
    @PostMapping("/insertFlashOrders")
    @ApiOperation("添加限时秒杀订单")
    public Result insertFlashOrders(@RequestBody UserPackageOrder userPackageOrder){
        //入参：用户ID，代金券IDS，会员优惠比，开始时间，结束时间，是否只限新用户
        return service.insertFlashOrders(userPackageOrder);
    }

}
