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.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.travelAddress.entity.TravelAddress;
import org.jeecg.modules.travelCollection.entity.TravelCollection;
import org.jeecg.modules.travelOrder.entity.TravelOrder;
import org.jeecg.modules.travelShopcar.entity.TravelShopcar;
import org.jeecg.modules.travelVolunteer.entity.TravelVolunteer;
import org.jeecg.modules.travelWaresOrder.entity.TravelWaresOrder;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags="小程序-个人中心相关接口")
@RestController
@RequestMapping("/api/user")
@Slf4j
public class UserInfoApiController {

    @Resource
    private IndexApiService indexApiService;


    /*******************个人信息****************************/
    //获取个人信息接口
    @ApiOperation(value="个人信息-查询用户个人信息", notes="个人信息-查询用户个人信息")
    @RequestMapping(value = "/queryHanHaiMemberById", method = {RequestMethod.GET})
    public Result<?> queryHanHaiMemberById(@RequestHeader("X-Access-Token") String token){
        return indexApiService.queryHanHaiMemberById(token);
    }

    //修改个人信息接口
    @ApiOperation(value="个人信息-修改用户个人信息", notes="个人信息-修改用户个人信息")
    @RequestMapping(value = "/updateHanHaiMemberById", method = {RequestMethod.POST})
    public Result<?> queryHanHaiMemberById(@RequestHeader("X-Access-Token") String token, HanHaiMember hanHaiMember){
        return indexApiService.updateHanHaiMemberById(token, hanHaiMember);
    }



    /*****************************************************个人中心*********************************************************************/

    /*******************我的收藏****************************/
    //获取我的收藏列表
    @ApiOperation(value="我的收藏-获取我的收藏列表", notes="collectionType：0-遗产讲述 1-达人同游 2-遗产路径 3-我要跟拍 4-非遗体验 5-我要研学 6-文创好物")
    @RequestMapping(value = "/queryCollectionList", method = {RequestMethod.GET})
    public Result<?> queryCollectionList(@RequestHeader("X-Access-Token") String token, String collectionType, PageBean pageBean){
        return indexApiService.queryCollectionList(token, collectionType, pageBean);
    }

    //添加收藏
    @ApiOperation(value="我的收藏-添加收藏", notes="我的收藏-添加收藏")
    @RequestMapping(value = "/addCollection", method = {RequestMethod.POST})
    public Result<?> addCollection(@RequestHeader("X-Access-Token") String token, TravelCollection travelCollection){
        return indexApiService.addCollection(token, travelCollection);
    }

    //取消收藏
    @ApiOperation(value="我的收藏-取消收藏", notes="我的收藏-取消收藏")
    @RequestMapping(value = "/deleteCollection", method = {RequestMethod.POST})
    public Result<?> deleteCollection(@RequestHeader("X-Access-Token") String token, String collectionType, String collectionId){
        return indexApiService.deleteCollection(token, collectionType, collectionId);
    }

    /*******************我的预约****************************/
    //时间段查询
    @ApiOperation(value="我的预约-查询预约时间段", notes="timeType：0-上午 1-下午")
    @RequestMapping(value = "/queryOrderTime", method = {RequestMethod.GET})
    public Result<?> queryOrderTime(String timeType){
        return indexApiService.queryOrderTime(timeType);
    }

    //查询订单信息
    @ApiOperation(value="我的预约-查询预约订单列表", notes="orderType：0-路径定制 1-遗产讲述 2-达人同游 3-我要跟拍 4-非遗体验 5-我要研学")
    @RequestMapping(value = "/queryOrderList", method = {RequestMethod.GET})
    public Result<?> queryOrderList(@RequestHeader("X-Access-Token") String token, String  orderType, PageBean pageBean){
        return indexApiService.queryOrderList(token, orderType, pageBean);
    }


    /*******************我的订单****************************/

    //创建预约订单
    @ApiOperation(value = "我的预约-创建预约订单",notes = "我的预约-创建预约订单")
    @PostMapping("/addOrder")
    public Result<?> addOrder(@RequestHeader("X-Access-Token") String token, TravelOrder travelOrder){
        return indexApiService.addOrder(token, travelOrder);
    }

    /*******************我的地址****************************/
    //查询地址
    @ApiOperation(value="我的地址-查询地址", notes="我的地址-查询地址")
    @RequestMapping(value = "/queryAddress", method = {RequestMethod.GET})
    public Result<?> queryAddress(@RequestHeader("X-Access-Token") String token, TravelAddress travelAddress, PageBean pageBean){
        return indexApiService.queryAddress(token, travelAddress, pageBean);
    }

    //新增地址
    @ApiOperation(value="我的地址-新增地址", notes="我的地址-新增地址")
    @RequestMapping(value = "/addAddress", method = {RequestMethod.POST})
    public Result<?> addAddress(@RequestHeader("X-Access-Token") String token, TravelAddress travelAddress){
        return indexApiService.addAddress(token, travelAddress);
    }

    //删除地址
    @ApiOperation(value="我的地址-删除地址", notes="我的地址-删除地址")
    @RequestMapping(value = "/deleteAddress", method = {RequestMethod.DELETE})
    public Result<?> deleteAddress(@RequestHeader("X-Access-Token") String token, String AddressId){
        return indexApiService.deleteAddress(token, AddressId);
    }

    //修改地址
    @ApiOperation(value="我的地址-修改地址", notes="我的地址-修改地址")
    @RequestMapping(value = "/updateAddress", method = {RequestMethod.POST})
    public Result<?> updateAddress(@RequestHeader("X-Access-Token") String token, TravelAddress travelAddress){
        return indexApiService.updateAddress(token, travelAddress);
    }

    //修改默认地址
    @ApiOperation(value="我的地址-修改默认地址", notes="我的地址-修改默认地址")
    @RequestMapping(value = "/updateDefaultAddress", method = {RequestMethod.POST})
    public Result<?> updateDefaultAddress(@RequestHeader("X-Access-Token") String token, String addressId){
        return indexApiService.updateDefaultAddress(token, addressId);
    }

    /*******************我的购物车****************************/
    //获取购物车列表
    @ApiOperation(value="我的购物车-获取购物车列表", notes="我的购物车-获取购物车列表")
    @RequestMapping(value = "/queryShopcarList", method = {RequestMethod.GET})
    public Result<?> queryShopcarList(@RequestHeader("X-Access-Token") String token, PageBean pageBean){
        return indexApiService.queryShopcarList(token, pageBean);
    }

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

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

    //修改购物车商品数量
    @ApiOperation(value="我的购物车-修改购物车信息", notes="我的购物车-修改购物车信息")
    @RequestMapping(value = "/updateShopcar", method = {RequestMethod.POST})
    public Result<?> updateShopcar(@RequestHeader("X-Access-Token") String token, TravelShopcar shopcar){
        return indexApiService.updateShopcar(token, shopcar);
    }

    /*******************加入志愿者****************************/
    //添加志愿者
    @ApiOperation(value="加入志愿者-添加志愿者", notes="加入志愿者-添加志愿者")
    @RequestMapping(value = "/addVolunteer", method = {RequestMethod.POST})
    public Result<?> addVolunteer(TravelVolunteer travelVolunteer){
        return indexApiService.addVolunteer(travelVolunteer);
    }


}
