package com.yida.data.user.feign;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.constant.FebsServerConstant;
import com.yida.data.common.core.entity.user.EduStaff;
import com.yida.data.common.core.entity.user.EduTeacherDept;
import com.yida.data.user.fallback.RemoteTeacherServiceFallback;
import com.yida.data.user.vo.TeacherCourseInfoVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = FebsServerConstant.EDU_USER, contextId = "teacherServiceClient",
        fallbackFactory = RemoteTeacherServiceFallback.class)
public interface RemoteTeacherService {

    /**
     * 更新教师信息
     */
    @PostMapping("/in/staff/dealWxTeacherChange")
    ResultBean dealWxTeacherChange(@RequestParam("schoolId") Long schoolId,
                                   @RequestParam("campusId") Long campusId,
                                   @RequestParam("sectionId") Long sectionId,
                                   @RequestParam("gradeId") Long gradeId,
                                   @RequestParam("classId") Long classId,
                                   @RequestBody List<Map> teacherList,
                                   @RequestParam("deptWxId") Long deptWxId);

    /**
     * 根据教师微信id查询教师信息
     */
    @GetMapping("/in/staff/getStaffByWxId")
    ResultBean<EduStaff> getTeacherByWx(@RequestParam("wxId") String wxId,
                                        @RequestParam("schoolId") Long schoolId);

    /**
     * 根据手机号查询教师
     */
    @GetMapping("/in/staff/getTeacherByMobileAndSchool")
    ResultBean<EduStaff> getTeacherByMobileAndSchool(@RequestParam("mobile") String mobile,
                                                     @RequestParam("schoolId") Long schoolId);

    /**
     * 根据学校和微信更新或新增教师
     */
    @PostMapping("/in/staff/saveStaffBySchoolAndWx")
    ResultBean saveStaffBySchoolAndWx(@RequestBody EduStaff eduStaff);

    /**
     * 根据家长手机号、学校查询学生班级的老师
     */
    @GetMapping("/staff/listTeacherByParent")
    ResultBean<List<EduStaff>> listTeacherByParent(@RequestParam("parentId") Long parentId,
                                                   @RequestParam("teacherName") String teacherName);

    @GetMapping("/staff/listTeacherBySchool")
    ResultBean<List<EduStaff>> listTeacherBySchool(@RequestParam("schoolId") Long schoolId, @RequestParam(
            "name") String name);

    /**
     * 保存易达appId
     */
    @GetMapping("/in/staff/saveYidaAppUserId")
    ResultBean saveYidaAppUserId(@RequestParam("staffId") Long staffId,
                                 @RequestParam("yidaAppUserId") String yidaAppUserId);

    /**
     * 按年级或者班级查询教师任课信息
     */
    @GetMapping("/staff/listTeacherCourseByGrade")
    ResultBean<List<TeacherCourseInfoVO>> listTeacherCourseByGrade(@RequestParam("gradeId") Long gradeId,
                                                                   @RequestParam("classId") Long classId);

    /**
     * 根据班级和名称查询教师
     */
    @GetMapping("/staff/listTeacherByClassAndName")
    ResultBean<List<EduStaff>> listTeacherByClassAndName(@RequestParam("classId") Long classId,
                                                         @RequestParam("name") String name);

    /**
     * 查询教师对应部门
     *
     * @param teacherId
     * @return
     */
    @GetMapping("/staff/listTeacherDeptByTeacher")
    ResultBean<List<EduTeacherDept>> listTeacherDeptByTeacher(@RequestParam("teacherId") Long teacherId);

    /**
     * 根据家校部门id和类型查询对应教师信息
     *
     * @param deptId 家校部门id
     * @param type   教师类型 1表示校区负责人，2表示年级负责人，3表示班主任，4表示任课老师，5表示学段负责人
     *               1表示班级，2表示年级，3表示学段，4表示校区
     * @return com.yida.data.common.core.common.ResultBean<java.util.List < com.yida.data.common.core.entity.user.EduStaff>>
     * @author ZYJ
     * @date 2022/7/15 17:48
     */
    @GetMapping("/in/staff/listTeacherByDeptId")
    ResultBean<List<EduStaff>> listTeacherByDeptId(@RequestParam("deptId") Long deptId,
                                                   @RequestParam("type") String type);
}
