package com.cm.websocket.controller.apis.user;

import com.cm.common.constants.ISystemConstant;
import com.cm.common.plugin.interfaces.IUserImBaseService;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResultLayImData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: DepartmentUserController
 * @Description: 用户即时消息
 * @Author: wanggeng
 * @Date: 2021/1/15 10:03 上午
 * @Version: 1.0
 */
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "用户即时消息")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/user/im")
public class UserImController {

    @Autowired
    private IUserImBaseService userImService;

    @ApiOperation(value = "获取初始化数据", notes = "获取初始化数据接口")
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("getinitdata")
    public SuccessResultLayImData<SuccessResultLayImData.InitData> getInitData() {
        return userImService.getInitData();
    }

    @ApiOperation(value = "获取组成员数据", notes = "获取组成员数据接口")
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("getmemberdata")
    public SuccessResultLayImData<SuccessResultLayImData.MemberData> getMemberData(@RequestParam(name = "id", required = true) String departmentId) {
        return userImService.getMemberData(departmentId);
    }

}
