package com.sckw.car.controller;

import com.sckw.car.entity.req.AddLogisticsOrderParam;
import com.sckw.car.service.CarTransportListService;
import com.sckw.car.service.CarTransportService;
import com.sckw.core.web.response.HttpResult;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @desc: 轿运控制器
 * @author: Lt
 * @date: 2024-04-15
 */
@Validated
@RestController
@RequestMapping("/car")
public class CarTransportController {

    @Autowired
    CarTransportService carTransportService;

    @Autowired
    CarTransportListService carTransportListService;

    
    /**
    * @Description: 轿运添加
    * @Author: Lt
    * @Date: 2024/4/17 11:12
    */
    @PostMapping("/addOrder")
    public HttpResult carTransportAdd(@RequestBody AddLogisticsOrderParam addLogisticsOrderParam)
    {
        return HttpResult.ok(carTransportService.carTransportAdd(addLogisticsOrderParam));
    }

    /**
    * @Description: 获取清单列表-轿运新增-货物明细-列表筛选
    * @Author: Lt
    * @Date: 2024/4/18 9:34
    */
    @GetMapping("/listDetail")
    public HttpResult listDetails(@RequestParam(value = "name", required = false) String name)
    {
        return HttpResult.ok(carTransportListService.listDetail(name));
    }

    /**
    * @Description: 轿运-详情
    * @Author: Lt
    * @Date: 2024/5/8 20:03
    */
    @GetMapping("/detail")
    public HttpResult detail(@RequestParam("orderId") String orderId)
    {
        return HttpResult.ok(carTransportListService.detail(orderId));
    }

    /**
     * @Description: 轿运-完结
     * @Author: Lt
     * @Date: 2024/5/8 20:03
     */
    @GetMapping("/completeDetail")
    public HttpResult completeDetail(@RequestParam("orderId") String orderId)
    {
        return HttpResult.ok(carTransportListService.completeDetail(orderId));
    }


    /**
    * @Description:
    * @Author: Lt
    * @Date: 2024/5/12 0012 17:49
    */
    @GetMapping("/getStatusCountListInSingleQuery")
    public HttpResult getStatusCountListInSingleQuery()
    {
        return HttpResult.ok(carTransportListService.getStatusCountListInSingleQuery());
    }

}
