package com.cxy.classroll.student.client;

import com.cxy.classroll.common.result.Result;
import com.cxy.classroll.model.entity.Lesson;
import com.cxy.classroll.model.entity.User;
import com.cxy.classroll.model.form.AuthenticationForm;
import com.cxy.classroll.model.vo.FileParam;
import com.cxy.classroll.model.vo.IdentifyAndID;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@FeignClient(value = "service-student")
public interface StudentFeignClient {

    @GetMapping("/student/common/login/{code}")
    public Result<IdentifyAndID> login(@PathVariable String code);

    @PostMapping("/student/common/authentication")
    public Result<Boolean> authentication(@RequestBody AuthenticationForm authenticationForm);

    @GetMapping("/student/common/userinfo/{id}")
    public Result<User> getUserInfo(@PathVariable Long id);

    @GetMapping("/student/lessonlist/{id}")
    public Result<List<Lesson>> getStudentLessons(@PathVariable Long id);

    @GetMapping("/student/studentsignin/{userid}/{lessonid}")
    public Result<Boolean> StudentSignInClass(@PathVariable(value = "userid") Long userid,@PathVariable(value = "lessonid")Long lessonid);

    @GetMapping("/student/studentsignout/{userid}/{lessonid}")
    public Result<Boolean> StudentSignOutClass(@PathVariable(value = "userid") Long userid,@PathVariable(value = "lessonid")Long lessonid);

    @GetMapping("/student/lessonstatus/{lessonid}")
    public Result<Integer> LessonStatus(@PathVariable Long lessonid);

    @GetMapping("/student/lessonroll/{lessonid}")
    public Result<Integer> LessonRoll(@PathVariable Long lessonid);

    @PostMapping(value = "/student/uploadcsv", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public Result<Boolean> uploadCsv(@RequestPart("multipartFile") MultipartFile multipartFile ,
                                     @RequestParam("teacher_id") Long teacher_id,
                                     @RequestParam("lesson_name") String lesson_name);

    @GetMapping("/student/classroll/{lessonid}/{roll_method}")
    public Result<String> classRoll(@PathVariable(value = "lessonid") Long lessonid, @PathVariable(value = "roll_method")int roll_method);

    @GetMapping("/student/scorerank")
    public Result<List<User>> scoreRank();

    @GetMapping("/student/comment/{lesson_id}/{student_no}/{score}")
    public Result<Boolean> comment(@PathVariable(value = "lesson_id") Long lesson_id, @PathVariable(value = "student_no") String student_no,
                                   @PathVariable(value = "score") int score);

    @GetMapping("/student/getnolist/{lesson_id}")
    public Result<List<String>> getNoList(@PathVariable(value = "lesson_id") Long lessonid);
}
