package com.keao.edu.im.api.client;

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.keao.edu.common.config.FeignConfiguration;
import com.keao.edu.im.api.client.callback.ImFeignServiceFallback;
import com.keao.edu.im.api.entity.ImGroupModel;
import com.keao.edu.im.api.entity.ImPrivateMessage;
import com.keao.edu.im.api.entity.ImResult;
import com.keao.edu.im.api.entity.ImUserModel;

@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 ImGroupModel groupModel);

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

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

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

	/**
	 * 解散群组
	 * @param groupModel
	 * @return
	 */
	@PostMapping(value = "group/dismiss")
	Object groupDismiss(@RequestBody ImGroupModel 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<ImGroupModel> groupModels);

	/**
	 * 发送私聊消息
	 * @param privateMessage
	 * @return
	 */
	@PostMapping(value = "private/send")
	//body模板
	//{"senderId":"325","targetId":[1094986],"objectName":"RC:TxtMsg",
	// "content":{"content":"www.baidu.com"}}
	Object privateSend(@RequestBody ImPrivateMessage privateMessage);

	/**
	 * 发送群组自定义消息
	 * @param groupMessage
	 * @return
	 */
//	@PostMapping(value = "private/sendCustom")
	//body模板
	//{"senderId":"325","targetId":[1094986],"objectName":"RC:TxtMsg",
	// "content":{"content":"www.baidu.com"}}
//	Object privateSendCustom(@RequestBody ImGroupMessage groupMessage);
}
