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.travelAddress.entity.TravelAddress;
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("/api/user")
@Slf4j
public class UserInfoApiController {

    @Resource
    private IndexApiService indexApiService;

    //根据角色类型获取角色信息列表-讲解员/达人/摄影师
    @ApiOperation(value="小程序-根据角色类型获取角色信息列表", notes="level: 1-金牌讲解员， 2-专业讲解员; roleId: 0-讲解员，1-达人，2-摄影师")
    @RequestMapping(value = "/queryRoleInfoList", method = {RequestMethod.GET})
    public Result<?> queryRoleInfoList(String roleId, String level, String spot, PageBean pageBean){
        return indexApiService.queryRoleInfoList(roleId, level, spot, pageBean);
    }

    //根据角色id获取角色信息详情
    @ApiOperation(value="小程序-根据角色Id获取角色信息详情", notes="小程序-根据角色Id获取角色信息详情")
    @RequestMapping(value = "/queryRoleInfoById", method = {RequestMethod.GET})
    public Result<?> queryRoleInfoById(String roleInfoId){
        return indexApiService.queryRoleInfoById(roleInfoId);
    }

    //查询地址
    @ApiOperation(value="小程序-查询地址", notes="小程序-查询地址")
    @RequestMapping(value = "/queryAddress", method = {RequestMethod.GET})
    public Result<?> queryAddress(TravelAddress travelAddress, PageBean pageBean){
        return indexApiService.queryAddress(travelAddress, pageBean);
    }

    //新增地址
    @ApiOperation(value="小程序-新增地址", notes="小程序-新增地址")
    @RequestMapping(value = "/addAddress", method = {RequestMethod.POST})
    public Result<?> addAddress(TravelAddress travelAddress){
        return indexApiService.addAddress(travelAddress);
    }

    //删除地址
    @ApiOperation(value="小程序-删除地址", notes="小程序-删除地址")
    @RequestMapping(value = "/deleteAddress", method = {RequestMethod.DELETE})
    public Result<?> deleteAddress(String AddressId){
        return indexApiService.deleteAddress(AddressId);
    }

    //修改地址
    @ApiOperation(value="小程序-修改地址", notes="小程序-修改地址")
    @RequestMapping(value = "/updateAddress", method = {RequestMethod.POST})
    public Result<?> updateAddress(TravelAddress travelAddress){
        return indexApiService.updateAddress(travelAddress);
    }

}
