package com.sqx.modules.errand.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.errand.entity.ErrandComplaint;
import com.sqx.modules.errand.service.ErrandComplaintService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/errandComplaint")
@Api(value = "管理端-跑腿投诉", tags = {"管理端-跑腿投诉"})
public class ErrandComplaintController {

    @Autowired
    private ErrandComplaintService errandComplaintService;

    @ApiOperation("查看全部投诉")
    @GetMapping(value = "findAllAppeal")
    public Result findAllAppeal(Integer page, Integer limit, Long userId, Integer illegalId, Integer complaintState, String indentNumber){

        return errandComplaintService.findAllAppeal(page, limit, userId, illegalId, complaintState, indentNumber);
    }

    @ApiOperation("审核用户投诉")
    @GetMapping(value = "updateCustomerComplaint")
    public Result updateCustomerComplaint(Long complaintId, Integer complaintState){

        return errandComplaintService.updateCustomerComplaint(complaintId, complaintState);
    }

    //审核骑手申诉
    @ApiOperation("是否通过骑手申诉")
    @PostMapping(value = "updateComplaintState")
    public Result updateComplaintState(@RequestBody ErrandComplaint errandComplaint){

        return errandComplaintService.updateComplaintState(errandComplaint);
    }

}
