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.LeaderService;
import org.jeecg.modules.apiService.ShopcarService;
import org.jeecg.modules.teambuyBuycar.entity.TeambuyBuycar;
import org.jeecg.modules.teambuyTeamLeader.entity.TeambuyTeamLeader;
import org.jeecg.modules.teambuyTeamRelation.entity.TeambuyTeamRelation;
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/leader")
@Slf4j
public class LeaderController {
    /******************************************************************************************************************/
    //团长
    @Resource
    private LeaderService leaderService;
    /******************************************************************************************************************/
    //团长申请
    @ApiOperation(value="我的-团长申请", notes="我的-团长申请")
    @RequestMapping(value = "/addLeader", method = {RequestMethod.POST})
    public Result<?> addLeader(@RequestHeader("X-Access-Token") String token, TeambuyTeamLeader teamLeader){
        return leaderService.addLeader(token, teamLeader);
    }

    //解绑团长
    @ApiOperation(value="我的-解绑团长", notes="我的-解绑团长")
    @RequestMapping(value = "/deleteLeader", method = {RequestMethod.POST})
    public Result<?> deleteLeader(@RequestHeader("X-Access-Token") String token, TeambuyTeamRelation teamRelation){
        return leaderService.deleteLeader(token, teamRelation);
    }

    //取消解绑
    @ApiOperation(value="我的-取消解绑", notes="我的-取消解绑")
    @RequestMapping(value = "/cancelDeleteLeader", method = {RequestMethod.POST})
    public Result<?> cancelDeleteLeader(@RequestHeader("X-Access-Token") String token, TeambuyTeamRelation teamRelation){
        return leaderService.cancelDeleteLeader(token, teamRelation);
    }

    //更换团长
    @ApiOperation(value="我的-更换团长", notes="我的-更换团长")
    @RequestMapping(value = "/updateLeader", method = {RequestMethod.POST})
    public Result<?> updateLeader(@RequestHeader("X-Access-Token") String token, TeambuyTeamRelation teamRelation){
        return leaderService.updateLeader(token, teamRelation);
    }

    //团长信息查询
    @ApiOperation(value="我的-查询团长信息", notes="我的-查询团长信息")
    @RequestMapping(value = "/queryLeaderInfo", method = {RequestMethod.GET})
    public Result<?> queryLeaderInfo(@RequestHeader("X-Access-Token") String token){
        return leaderService.queryLeaderInfo(token);
    }

    //团长信息修改
    @ApiOperation(value="我的-修改团长信息", notes="我的-修改团长信息")
    @RequestMapping(value = "/updateLeaderInfo", method = {RequestMethod.POST})
    public Result<?> updateLeaderInfo(@RequestHeader("X-Access-Token") String token, TeambuyTeamLeader teamLeader){
        return leaderService.updateLeaderInfo(token, teamLeader);
    }

    //团员列表信息查询
    @ApiOperation(value="我的-我的团员", notes="我的-我的团员")
    @RequestMapping(value = "/queryMemberList", method = {RequestMethod.GET})
    public Result<?> queryMemberList(@RequestHeader("X-Access-Token") String token, PageBean pageBean){
        return leaderService.queryMemberList(token, pageBean);
    }

    //团长列表查询
    @ApiOperation(value="我的-查询团长列表(下单选择地址)", notes="我的-查询团长列表(下单选择地址)")
    @RequestMapping(value = "/queryLeaderList", method = {RequestMethod.GET})
    public Result<?> queryLeaderList(PageBean pageBean){
        return leaderService.queryLeaderList(pageBean);
    }

    //查询绑定团长信息
    @ApiOperation(value="我的-查询绑定团长信息(默认下单地址)", notes="我的-查询绑定团长信息(默认下单地址)")
    @RequestMapping(value = "/queryMyLeader", method = {RequestMethod.GET})
    public Result<?> queryMyLeader(@RequestHeader("X-Access-Token") String token){
        return leaderService.queryMyLeader(token);
    }

}
