package com.sqx.modules.driver.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.driver.entity.Driver;
import com.sqx.modules.driver.service.DriverService;
import com.sqx.modules.orders.service.OrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@Api(value = "司机-管理端", tags = {"司机-管理端"})
@RequestMapping("/driver")
public class DriverController {

    @Autowired
    private DriverService driverService;

    @PostMapping("/insertDriver")
    @ApiOperation("提交司机资料认证")
    public Result insertDriver(@RequestBody Driver driver){
        return driverService.insertDriver(driver);
    }

    @PostMapping("/updateDriver")
    @ApiOperation("修改司机资料")
    public Result updateDriver(@RequestBody Driver driver){
        return driverService.updateDriver(driver);
    }

    @PostMapping("/deleteDriver")
    @ApiOperation("删除司机资料")
    public Result deleteDriver(Long driverId){
        return driverService.deleteDriver(driverId);
    }

    @GetMapping("/selectDriverByUserId")
    @ApiOperation("查询指定用户的司机信息")
    public Result selectDriverByUserId(Long userId){
        return Result.success().put("data",driverService.selectDriverByUserId(userId));
    }

    @GetMapping("/selectDriverList")
    @ApiOperation("查询司机列表")
    public Result selectDriverList(Integer page,Integer limit,String driverName,String userName,String phone,Integer status){
        return driverService.selectDriverList(page, limit, driverName, userName, phone, status);
    }

    @PostMapping("/auditDriver")
    @ApiOperation("审核司机")
    public Result auditDriver(String ids,Integer status,String auditContent){
        return driverService.auditDriver(ids, status, auditContent);
    }


}