package com.template.api;

import com.template.model.request.*;
import com.template.model.result.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: binguo
 * @Date: 2023/3/30 星期四 17:28
 * @Description: com.video.api
 * @Version: 1.0
 */
@RequestMapping("/api/smartUser")
@Api(tags = {"SmartUserControllerAPI"}, value = "用户")
public interface SmartUserControllerAPI {
    /**
     * 注销账号
      */
    @PostMapping(value = "logoffAccount")
    @ApiOperation(value = "注销账号", notes = "注销账号", httpMethod = "POST")
    CommonResult logoffAccount(@Validated @RequestBody useridsRequest ur, BindingResult bindingResult);

    /**
     * 移动多个用户到其他部门
     */
    @PostMapping(value = "changeDepartment")
    @ApiOperation(value = "移动多个用户到其他部门", notes = "移动多个用户到其他部门", httpMethod = "POST")
    CommonResult changeDepartment(@Validated @RequestBody changeDepartmentRequest cdr, BindingResult bindingResult);

    /**
     * 批量导入用户信息
     * @param excelFile excel文件
     * @return
     */
    @PostMapping(value = "importExcelUsers")
    @ApiOperation(value = "批量导入用户信息", notes = "批量导入用户信息", httpMethod = "POST")
    CommonResult importExcelUsers(@RequestParam("file") MultipartFile excelFile, @RequestParam String headImage) throws IOException;

    /**
     * 批量导入压缩包
     * @param zipFile 附件文件
     * @return
     */
    @PostMapping(value = "importZipUsers")
    @ApiOperation(value = "批量导入", notes = "批量导入", httpMethod = "POST")
    CommonResult importZipUsers(@RequestParam("file") MultipartFile zipFile) throws IOException;


    @PostMapping(value = "/insertSmartUser")
    @ApiOperation(value = "添加用户", notes = "添加用户数据", httpMethod = "POST")
    CommonResult insertSmartUser(@Validated @RequestBody insertSmartUserRequest isur, BindingResult bindingResult) throws Exception;

    @PostMapping(value = "/updateSmartUserById")
    @ApiOperation(value = "编辑用户数据", notes = "编辑用户数据", httpMethod = "POST")
    CommonResult updateSmartUserById(@Validated @RequestBody updateSmartUserRequest ra, BindingResult bindingResult) throws Exception;

    @GetMapping(value = "/queryPageSmartUser")
    @ApiOperation(value = "用户分页数据", notes = "用户分页数据", httpMethod = "GET")
    CommonResult queryPageSmartUser(@RequestParam int currentPage, @RequestParam int pageCount, Integer departmentId, String name);

    /**
     * 导出用户数据
     */
    @GetMapping(value = "smartUserExport")
    @ApiOperation(value = "导出用户数据", notes = "导出用户数据", httpMethod = "GET")
    void smartUserExport(HttpServletResponse response, Integer departmentId, String name);

    @PostMapping(value = "/deleteSmartUserById")
    @ApiOperation(value = "根据ID删除指定用户", notes = "根据ID删除指定用户", httpMethod = "POST")
    CommonResult deleteSmartUserById(@Validated @RequestBody useridsRequest ur, BindingResult bindingResult);

    /**
     * 学生家长预约信息填写界面获取受访学生列表
     */
    @GetMapping(value = "/queryAffiliateUserById")
    @ApiOperation(value = "根据当前用户ID获取受访学生数据", notes = "根据当前用户ID获取受访学生数据", httpMethod = "GET")
    CommonResult queryAffiliateUserById(@RequestParam int id);

    /**
     * 时间组数据集合
     */
    @GetMapping(value = "/timeGroups")
    @ApiOperation(value = "时间组数据集合", notes = "时间组数据集合", httpMethod = "GET")
    CommonResult timeGroups();

    /**
     * 导出人员模板
     * @return
     */
    @GetMapping(value = "/downloadUserExcel")
    @ApiOperation(value = "导出人员Excel模板", notes = "导出人员Excel模板", httpMethod = "GET")
    CommonResult downloadUserExcel();

    /**
     * 导出人员模板
     * @return
     */
    @GetMapping(value = "/queryStudents")
    @ApiOperation(value = "根据用户ID查询学生", notes = "根据用户ID查询学生", httpMethod = "GET")
    CommonResult queryStudents(@RequestParam int userId);

    /**
     * 根据数据ID获取用户信息
     */
    @GetMapping(value = "/queryInfoData")
    @ApiOperation(value = "根据数据ID获取用户信息", notes = "根据数据ID获取用户信息", httpMethod = "GET")
    CommonResult queryInfoData(@RequestParam int id);

    /**
     * 绑定学生
     * @param isur
     * @param bindingResult
     * @return
     */
    @PostMapping(value = "/bindStudent")
    @ApiOperation(value = "绑定学生", notes = "绑定学生", httpMethod = "POST")
    CommonResult bindStudent(@Validated @RequestBody bindStudentRequest isur, BindingResult bindingResult);

}
