package com.ym.mec.im;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import com.ym.mec.common.config.FeignConfiguration;
import com.ym.mec.common.entity.ImGroupMessage;
import com.ym.mec.common.entity.ImGroupModel;
import com.ym.mec.common.entity.ImPrivateMessage;
import com.ym.mec.common.entity.ImResult;
import com.ym.mec.common.entity.ImUserModel;
import com.ym.mec.im.entity.GroupModel;
import com.ym.mec.im.fallback.ImFeignServiceFallback;

@FeignClient(name = "im-server", configuration = FeignConfiguration.class, fallback = ImFeignServiceFallback.class)
public interface ImFeignService {

	/**
	 * 用户注册
	 * @param userModel
	 * @return
	 */
	@PostMapping(value = "user/register", consumes = MediaType.APPLICATION_JSON_VALUE)
	ImResult register(@RequestBody ImUserModel userModel);

	/**
	 * 用户信息修改
	 * @param userModel
	 * @return
	 */
	@PostMapping(value = "user/update", consumes = MediaType.APPLICATION_JSON_VALUE)
	void update(@RequestBody ImUserModel userModel);

	/**
	 * 创建群组
	 * @param groupModel
	 * @return
	 */
	@PostMapping(value = "group/create")
	Object groupCreate(@RequestBody GroupModel groupModel);

	/**
	 * 批量创建群组
	 * @param groupModels
	 * @return
	 */
	@PostMapping(value = "group/batchCreate")
	void groupBatchCreate(@RequestBody List<GroupModel> groupModels);

	/**
	 * 加入群组
	 * @param groupModel
	 * @return
	 */
	@PostMapping(value = "group/join")
	Object groupJoin(@RequestBody GroupModel groupModel);

	/**
	 * 批量加入群组
	 * @param groupModels
	 * @return
	 */
	@PostMapping(value = "group/batchJoin")
	Object groupBatchJoin(@RequestBody List<GroupModel> groupModels);

	/**
	 * 退出群组
	 * @param groupModel
	 * @return
	 */
	@PostMapping(value = "group/quit")
	Object groupQuit(@RequestBody GroupModel groupModel);

	/**
	 * 解散群组
	 * @param groupModel
	 * @return
	 */
	@PostMapping(value = "group/dismiss")
	Object groupDismiss(@RequestBody GroupModel groupModel);

	/**
	 * 批量解散群组
	 * @param groupModels
	 * @return
	 */
	@PostMapping(value = "group/batchDismiss")
	Object groupBatchDismiss(@RequestBody List<ImGroupModel> groupModels);

	/**
	 * 批量退出群组
	 * @param groupModels
	 * @return
	 */
	@PostMapping(value = "group/batchQuit")
	Object groupBatchQuit(@RequestBody List<GroupModel> groupModels);

	/**
	 * 发送私聊消息
	 * @param privateMessage
	 * @return
	 */
	@PostMapping(value = "private/send")
	Object privateSend(@RequestBody ImPrivateMessage privateMessage);

	@PostMapping(value = "group/send")
	Object groupSend(@RequestBody ImGroupMessage imGroupMessage);
}
