package com.ym.mec.web.controller;

import com.ym.mec.biz.dal.dto.ImGroupMemberDto;
import com.ym.mec.biz.dal.page.GroupMemberQueryInfo;
import com.ym.mec.biz.service.ImGroupMemberService;
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.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("imGroupMember")
@Api(tags = "IM群成员服务")
@RestController
public class ImGroupMemberController extends BaseController {

	@Autowired
	private ImGroupMemberService imGroupMemberService;

	@ApiOperation("分页查询群成员列表")
	@PostMapping(value = "/queryGroupMemberPage")
	public HttpResponseResult<PageInfo<ImGroupMemberDto>> queryGroupMemberPage(GroupMemberQueryInfo queryInfo) {
		return succeed(imGroupMemberService.queryGroupMemberPage(queryInfo));
	}

	@ApiOperation("添加群成员")
	@PostMapping(value = "/addGroupMember")
	@ApiImplicitParams({ @ApiImplicitParam(name = "imGroupId", value = "群编号", required = true, dataType = "String"),
			@ApiImplicitParam(name = "roleType", value = "指导老师,乐队指导,乐团主管,运营主管,学员不传", required = true, dataType = "String"),
			@ApiImplicitParam(name = "userId", value = "用户编号（多个逗号分割）", required = true, dataType = "String")})
	public Object addGroupMember(String imGroupId, String userId, String roleType) {
		imGroupMemberService.batchJoin(imGroupId,userId,roleType);
		return succeed();
	}
}
