package com.ym.mec.web.controller;


import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.biz.dal.vo.ImLiveRoomBlackVo;
import com.ym.mec.biz.service.ImLiveRoomBlackService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import com.ym.mec.common.page.PageInfo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 直播房间黑名单表(ImLiveRoomBlack)表控制层
 *
 * @author hgw
 * @since 2022-05-30 14:58:31
 */
@RestController
@RequestMapping("/imLiveRoomBlack")
public class ImLiveRoomBlackController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private ImLiveRoomBlackService imLiveRoomBlackService;

    @ApiImplicitParams({
            @ApiImplicitParam(name = "roomUid", dataType = "String", value = "直播房间uid"),
            @ApiImplicitParam(name = "search", dataType = "String", value = "搜索关键字-用户id，用户名，手机号", required = true),
            @ApiImplicitParam(name = "page", dataType = "Integer", value = "页数"),
            @ApiImplicitParam(name = "rows", dataType = "Integer", value = "每页数量"),
    })
    @ApiOperation("查询当前机构学生 -下拉框")
    @PostMapping("/queryStudentList")
    public HttpResponseResult<PageInfo<SysUser>> queryStudentList(@RequestBody Map<String, Object> param) {
        return succeed(imLiveRoomBlackService.queryStudentList(param));
    }

    @ApiImplicitParams({
            @ApiImplicitParam(name = "roomUid", dataType = "String", value = "直播房间uid"),
            @ApiImplicitParam(name = "userIdList", dataType = "String", value = "用户id多个用逗号隔开"),
    })
    @ApiOperation("添加用户到房间黑名单中")
    @PostMapping("/add")
    public HttpResponseResult<Object> add(@RequestBody Map<String, Object> param) {
        imLiveRoomBlackService.add(param);
        return succeed();
    }

    @ApiImplicitParams({
            @ApiImplicitParam(name = "roomUid", dataType = "String", value = "直播房间uid"),
            @ApiImplicitParam(name = "userIdList", dataType = "String", value = "用户id多个用逗号隔开"),
    })
    @ApiOperation("删除该用户从房间黑名单中移除")
    @PostMapping("/delete")
    public HttpResponseResult<Object> delete(@RequestBody Map<String, Object> param) {
        imLiveRoomBlackService.delete(param);
        return succeed();
    }

    @ApiImplicitParams({
            @ApiImplicitParam(name = "roomUid", dataType = "String", value = "直播房间uid"),
            @ApiImplicitParam(name = "search", dataType = "String", value = "搜索关键字-用户id，用户名，手机号"),
            @ApiImplicitParam(name = "page", dataType = "Integer", value = "页数"),
            @ApiImplicitParam(name = "rows", dataType = "Integer", value = "每页数量"),
    })
    @ApiOperation("分页查询直播间列表")
    @PostMapping("/queryBlackList")
    public HttpResponseResult<PageInfo<ImLiveRoomBlackVo>> queryBlackList(@RequestBody Map<String, Object> param) {
        return succeed(imLiveRoomBlackService.queryBlackList(param));
    }

}

