package com.sckw.transport.controller;

import com.sckw.core.web.response.BaseResult;
import com.sckw.core.web.response.result.PageDataResult;
import com.sckw.transport.model.param.CurrentTaskTraceReq;
import com.sckw.transport.model.param.KwfTruckTraceReplayReq;
import com.sckw.transport.model.param.TruckInfoReq;
import com.sckw.transport.model.vo.CurrentTaskTraceReqVo;
import com.sckw.transport.model.vo.KwfTruckTraceReplayVo;
import com.sckw.transport.model.vo.TruckInfoVo;
import com.sckw.transport.service.kwfTruckTraceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * @author cxf
 * @desc 车辆轨迹接口
 */
@RestController
@RequestMapping("/kwfTruckTrace")
@RequiredArgsConstructor
@Tag(name = "车辆轨迹相关接口")
public class KwfTruckTraceController {
    private final kwfTruckTraceService kwfTruckTraceService;

    /**
     * 获取车辆实时位置信息
     */
    @PostMapping("/queryTruckInfo")
    @Operation(summary = "获取车辆实时位置信息")
    public BaseResult<TruckInfoVo> queryTruckInfo(@RequestBody TruckInfoReq req )  {
        TruckInfoVo truckInfoVo = kwfTruckTraceService.queryTruckInfo(req);
        return BaseResult.success(truckInfoVo);
    }

    /**
     * 查询当前任务的线路
     */
    @PostMapping("/queryCurrentTaskTrace")
    @Operation(summary = "查询当前任务的线路")
    public BaseResult<CurrentTaskTraceReqVo> queryCurrentTaskTrace(@Valid @RequestBody CurrentTaskTraceReq req )  {
        CurrentTaskTraceReqVo taskTrace = kwfTruckTraceService.queryCurrentTaskTrace(req);
        return BaseResult.success(taskTrace);
    }

    /**
     * 查询当前车辆的轨迹明细
     */
    @PostMapping("/queryCurrentTruckTrace")
    @Operation(summary = "查询当前车辆的轨迹明细")
    public BaseResult<CurrentTaskTraceReqVo> queryCurrentTruckTrace(@RequestBody CurrentTaskTraceReq req )  {
        CurrentTaskTraceReqVo taskTrace = kwfTruckTraceService.queryCurrentTruckTrace(req);
        return BaseResult.success(taskTrace);
    }


    /**
     * 轨迹回放
     */
    @PostMapping("/replay")
    @Operation(summary = "轨迹回放")
    public BaseResult<PageDataResult<KwfTruckTraceReplayVo>> findPage(@RequestBody KwfTruckTraceReplayReq req )  {

        return BaseResult.success( kwfTruckTraceService.findPage(req));
    }

}
