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


import com.keao.edu.common.config.FeignConfiguration;
import com.keao.edu.common.entity.HttpResponseResult;
import com.keao.edu.im.api.entity.PublishMessageDto;
import com.keao.edu.user.api.client.fallback.EduUserFeignServiceFallback;
import com.keao.edu.user.api.entity.ExamRoom;
import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
import com.keao.edu.user.api.enums.StudentExamResultApiDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(contextId = "eduUserFeignService", name = "user-server", configuration = { FeignConfiguration.class }, fallback = EduUserFeignServiceFallback.class)
public interface EduUserFeignService {

	/**
	 * 获取考场信息
	 * @param paramName
	 * @return
	 */
	@PostMapping(value = "sysConfig/api/get")
	String getSysConfig(@RequestParam("paramName") String paramName);

	/**
	 * 获取考场信息
	 * @param examRegistrationId
	 * @return
	 */
	@PostMapping(value = "examRoomStudentRelation/api/getPublishMessage")
	PublishMessageDto getPublishMessage(@RequestParam("examRegistrationId") Long examRegistrationId);

	/**
	 * 获取考场信息
	 * @param id
	 * @return
	 */
	@PostMapping(value = "examRoom/api/get")
	ExamRoom getExamRoom(@RequestParam("id") Integer id);

	/**
	 * 获取考场信息
	 * @param id
	 * @return
	 */
	@PostMapping(value = "studentExamResult/api/get")
	StudentExamResultApiDto getExamResult(@RequestParam("id") Long id);

	/**
	 * 学生报名
	 * @param organId
	 * @param phone
	 * @return
	 */
	@PostMapping(value = "student/apply")
	Object studentApply(@RequestParam("organId") Integer organId, @RequestParam("phone") String phone);

	/**
	 * 获取考场与学生关联
	 * @param registrationId
	 * @return
	 */
	@PostMapping(value = "examRoomStudentRelation/api/getExamRoomStudentRelation")
	ExamRoomStudentRelation getExamRoomStudentRelation(@RequestParam("registrationId") Long registrationId);

	/**
	 * 修改学员考试状态
	 * @param examRegistrationId
	 * @param finishedExam
	 */
	@PostMapping(value = "studentExamResult/api/updateFinishedExam")
	void updateFinishedExam(@RequestParam("examRegistrationId") Long examRegistrationId, @RequestParam("finishedExam") Integer finishedExam);

	/**
	 * 获取学员教室关联
	 * @param examRegistrationId
	 * @param sessionId
	 */
	@PostMapping(value = "studentExamResult/api/updateSessionId")
	void updateSessionId(@RequestParam("examRegistrationId") Long examRegistrationId, @RequestParam("sessionId") String sessionId);

	/**
	 * 更新学员考勤
	 * @param examRegistrationId
	 * @param signFlag
	 * @return
	 */
	@PostMapping(value = "studentAttendance/api/upsetStudentAttendance")
	HttpResponseResult upsetStudentAttendance(@RequestParam("examRegistrationId") Long examRegistrationId,@RequestParam("signFlag") Integer signFlag);

	/**
	 * 更新教师考勤
	 * @param roomId
	 * @param userId
	 * @param signFlag
	 * @return
	 */
	@PostMapping(value = "teacherAttendance/api/upsetTeacherAttendance")
	HttpResponseResult upsetTeacherAttendance(@RequestParam("roomId") Long roomId,@RequestParam("userId") Integer userId,@RequestParam("signFlag") Integer signFlag);
}
