package com.repair.api;

import com.repair.model.request.insertRepairAssociationRequest;
import com.repair.model.request.insertRepairConsumeRequest;
import com.repair.model.request.updateRepairConsumeRequest;
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 org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;

@RequestMapping("/api/repairConsume")
@Api(tags = {"RepairConsumeController"}, value = "耗材管理")
public interface RepairConsumeControllerAPI {

    @PostMapping(value = "/insertRepairAssociation")
    @ApiOperation(value = "关联耗材中添加耗材", notes = "关联耗材中添加耗材", httpMethod = "POST")
    CommonResult InsertRepairAssociation(@Validated @RequestBody insertRepairAssociationRequest irc, BindingResult bindingResult);

    @PostMapping(value = "/insertRepairConsume")
    @ApiOperation(value = "添加耗材管理", notes = "添加耗材管理数据", httpMethod = "POST")
    CommonResult InsertRepairConsume(@Validated @RequestBody insertRepairConsumeRequest rc, BindingResult bindingResult);

    @PostMapping(value = "/updateRepairConsumeById")
    @ApiOperation(value = "编辑耗材管理数据", notes = "编辑耗材管理数据", httpMethod = "POST")
    CommonResult updateRepairConsumeById(@Validated @RequestBody updateRepairConsumeRequest rc, BindingResult bindingResult);

    @GetMapping(value = "/queryPageRepairConsume")
    @ApiOperation(value = "耗材管理分页数据", notes = "耗材管理分页数据", httpMethod = "GET")
    CommonResult queryPageRepairConsumes(@RequestParam int currentPage, @RequestParam int pageCount, String name, String startTime, String endTime);

    @GetMapping(value = "/deleteRepairConsumeById")
    @ApiOperation(value = "根据ID删除指定耗材管理", notes = "根据ID删除指定耗材管理", httpMethod = "GET")
    CommonResult deleteRepairConsumeById(@RequestParam int id);

    @GetMapping(value = "/downloadRepairConsumeExcel")
    @ApiOperation(value = "导出耗材数据", notes = "导出耗材数据", httpMethod = "GET")
    void downloadRepairConsumeExcel(String name, String startTime, String endTime, HttpServletResponse response) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException;

    @GetMapping(value = "/downloadRepairConsumeModelExcel")
    @ApiOperation(value = "导出耗材模板", notes = "导出耗材模板", httpMethod = "GET")
    void downloadRepairConsumeModelExcel(HttpServletResponse response);

    @PostMapping(value = "/importRepairConsumeExcel")
    @ApiOperation(value = "导入耗材数据", notes = "导入耗材数据", httpMethod = "POST")
    CommonResult importRepairConsumeExcel(@RequestParam("file") MultipartFile file) throws IOException;

    @GetMapping(value = "/queryRepairConsumeTypeTree")
    @ApiOperation(value = "查询耗材树形结构数据", notes = "查询耗材树形结构数据", httpMethod = "GET")
    CommonResult queryRepairConsumeTypeTree(int schoolId);

    @GetMapping(value = "/queryRepairConsumesBykey")
    @ApiOperation(value = "根据关键字查询二级耗材数据", notes = "根据关键字查询二级耗材数据", httpMethod = "GET")
    CommonResult queryRepairConsumesBykey(int schoolId, String keyWord);
}
