package com.sckw.car.controller;

import com.sckw.car.entity.req.KwOrderCarCompleteParam;
import com.sckw.car.entity.req.KwOrderSendCarParam;
import com.sckw.car.service.KwWayBillService;
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-18
 */
@Validated
@RestController
@RequestMapping("/car/waybill")
public class WayBillController {

    @Autowired
    KwWayBillService kwWayBillService;

    /**
    * @Description: 轿运-派车
    * @Author: Lt
    * @Date: 2024/4/18 15:17
    */
    @PostMapping("/sendCar")
    public HttpResult sendCar(@RequestBody @Valid KwOrderSendCarParam kwOrderSendCarParam)
    {
        return kwWayBillService.sendCarInsert(kwOrderSendCarParam);
    }

    /**
    * @Description: 轿运-派车草稿
    * @Author: Lt
    * @Date: 2024/4/18 15:17
    */
    @PostMapping("/sendCarDraft")
    public HttpResult sendCarDraft(@RequestBody @Valid KwOrderSendCarParam kwOrderSendCarParam)
    {
        return kwWayBillService.sendCarDraft(kwOrderSendCarParam);
    }

    /**
    * @Description: 完结订单-订单详情
    * @Author: Lt
    * @Date: 2024/4/22 10:29
    */
    @GetMapping("/waybillDetail")
    public HttpResult waybillDetail(@RequestParam(value = "orderId", required = false) String orderId)
    {
        return HttpResult.ok(kwWayBillService.waybillDetail(orderId));
    }

    /**
     * @Description: 轿运-完结订单
     * @Author: Lt
     * @Date: 2024/4/18 15:17
     */
    @PostMapping("/completeOrder")
    public HttpResult completeOrder(@RequestBody @Valid KwOrderCarCompleteParam kwOrderCarCompleteParam)
    {
        return kwWayBillService.completeOrder(kwOrderCarCompleteParam);
    }


}
