package com.repair.api;

import com.repair.model.pojo.RepairAdmin;
import com.repair.model.request.freezeRepairAdminRequest;
import com.repair.model.request.updateRepairAdminRequest;
import com.repair.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 javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;

@RequestMapping("/api/repairAdmin")
@Api(tags = {"RepairAdminController"}, value = "账号")
public interface RepairAdminControllerAPI {

    @GetMapping(value = "/resetPassword")
    @ApiOperation(value = "重置密码", notes = "重置密码", httpMethod = "GET")
    CommonResult resetPassword(@RequestParam String id);

    @PostMapping(value = "/insertRepairAdmin")
    @ApiOperation(value = "添加账号", notes = "添加账号数据", httpMethod = "POST")
    CommonResult InsertRepairAdmin(@Validated @RequestBody RepairAdmin repairAdmin, @RequestHeader("user_head") String userhead, BindingResult bindingResult);

    @GetMapping(value = "/queryPageRepairAdmin")
    @ApiOperation(value = "账号分页数据", notes = "账号分页数据", httpMethod = "GET")
    CommonResult queryPageRepairAdmins(@RequestParam int currentPage, @RequestParam int pageCount, String account, String startTime, String endTime);

    @PostMapping(value = "/freezeRepairAdminById")
    @ApiOperation(value = "根据ID冻结指定账号", notes = "根据ID冻结指定账户", httpMethod = "POST")
    CommonResult freezeRepairAdminById(@Validated @RequestBody freezeRepairAdminRequest frar, BindingResult bindingResult);

    @GetMapping(value = "/deleteRepairAdminById")
    @ApiOperation(value = "根据ID删除指定账号", notes = "根据ID删除指定账号", httpMethod = "POST")
    CommonResult deleteRepairAdminById(@RequestParam String id);

    @PostMapping(value = "/updateRepairAdminById")
    @ApiOperation(value = "编辑账号数据", notes = "编辑账号数据", httpMethod = "POST")
    CommonResult updateRepairAdminById(@Validated @RequestBody updateRepairAdminRequest ra, @RequestHeader("user_head") String userhead, BindingResult bindingResult);

    @GetMapping(value = "/downloadRepairAdminExcel")
    @ApiOperation(value = "导出账号数据", notes = "导出账号数据", httpMethod = "GET")
    void downloadRepairAdminExcel(String account, String startTime, String endTime, HttpServletResponse response) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException;
}
