package org.jeecg.modules.api.teambuyController;

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.OrderService;
import org.jeecg.modules.apiService.ShopcarService;
import org.jeecg.modules.teambuyBuycar.entity.TeambuyBuycar;
import org.jeecg.modules.teambuyOrderMember.entity.TeambuyOrderMember;
import org.springframework.web.bind.annotation.RequestHeader;
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("/teambuy/shopcar")
@Slf4j
public class ShopcarContrller {
    /******************************************************************************************************************/
    //购物车
    @Resource
    private ShopcarService shopcarService;
    /******************************************************************************************************************/
    //查看购物车列表
    @ApiOperation(value="购物车-查看购物车列表/详情", notes="购物车-查看购物车列表/详情")
    @RequestMapping(value = "/queryShopcarList", method = {RequestMethod.GET})
    public Result<?> queryShopcarList(@RequestHeader("X-Access-Token") String token, TeambuyBuycar teambuyBuycar, PageBean pageBean){
        return shopcarService.queryShopcarList(token, teambuyBuycar, pageBean);
    }

    //添加购物车
    @ApiOperation(value="购物车-添加购物车", notes="购物车-添加购物车")
    @RequestMapping(value = "/addShopcar", method = {RequestMethod.POST})
    public Result<?> addShopcar(@RequestHeader("X-Access-Token") String token, TeambuyBuycar teambuyBuycar){
        return shopcarService.addShopcar(token, teambuyBuycar);
    }

    //取消购物车
    @ApiOperation(value="购物车-取消购物车", notes="购物车-取消购物车")
    @RequestMapping(value = "/deleteShopcar", method = {RequestMethod.POST})
    public Result<?> deleteShopcar(@RequestHeader("X-Access-Token") String token, String shopcarId){
        return shopcarService.deleteShopcar(token, shopcarId);
    }

}
