package com.ym.controller;

import com.ym.service.ChatroomService;
import io.rong.models.chatroom.ChatroomModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by weiqinxiao on 2019/2/25.
 */
@RestController
@RequestMapping("/whitelist")
public class WhitelistController {

    @Autowired
    ChatroomService chatroomService;

    @RequestMapping(value = "/user/add", method = RequestMethod.POST)
    public Object userAdd(@RequestBody ChatroomModel chatroomModel) throws Exception {
        return chatroomService.whitelistUserAdd(chatroomModel);
    }

    @RequestMapping(value = "/user/remove", method = RequestMethod.POST)
    public Object userRemove(@RequestBody ChatroomModel chatroomModel) throws Exception {
        return chatroomService.whitelistUserRemove(chatroomModel);
    }

    @RequestMapping(value = "/user/getList", method = RequestMethod.POST)
    public Object userGetList(@RequestBody ChatroomModel chatroomModel) throws Exception {
        return chatroomService.whitelistUserGetList(chatroomModel);
    }

    @RequestMapping(value = "/message/add", method = RequestMethod.POST)
    public Object messageAdd(@RequestBody String[] objectNames) throws Exception {
        return chatroomService.whitelistMessageAdd(objectNames);
    }

    @RequestMapping(value = "/message/remove", method = RequestMethod.POST)
    public Object messageRemove(@RequestBody String[] objectNames) throws Exception {
        return chatroomService.whitelistMessageRemove(objectNames);
    }

    @RequestMapping(value = "/message/getList", method = RequestMethod.POST)
    public Object messageGetList() throws Exception {
        return chatroomService.whitelistMessageGetList();
    }
}
