package bus.controller.biz;

import bus.model.dto.BBusInfoDto;
import bus.model.dto.BBusTrackInfoDto;
import bus.model.dto.BBusTrackTreeDto;
import bus.model.dto.BTrackStationDto;
import bus.model.dto.page.BBusInfoPageDto;
import bus.model.po.BBusInfoPo;
import bus.service.BBusInfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageSerializable;
import com.qzwisdom.qzframework.core.tool.base.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


/**
 * @Program: bus
 * @Description: 描述
 * @Author: zy
 * @Date: 2025-03-01 10:04:08
 **/
@Slf4j
@CrossOrigin
@RestController
@Api(tags = "车辆追踪接口")
@RequestMapping(value="/bBusTrackInfo")
public class BBusTrackController implements BaseController {

    @Autowired
    private BBusInfoService bBusInfoService;


    /**
     * 获取车辆状态树型数据
     * @return
     */
    @ApiOperation("获取车辆状态树型数据")
    @GetMapping(value = "getTreeList")
    public List<BBusTrackTreeDto> getTreeList(){
        List<BBusTrackTreeDto> treeList = bBusInfoService.getTreeList();
        return treeList;
    }

    /**
     * 根据车辆ID获取车辆追踪信息
     * @return
     */
    @ApiOperation("根据车辆ID获取车辆追踪信息")
    @GetMapping(value = "getTrackInfo")
    public BBusTrackInfoDto getTrackInfo(@RequestParam String busId){
        BBusTrackInfoDto trackInfo = bBusInfoService.getTrackInfo(busId);
        return trackInfo;
    }

    @ApiOperation("根据车辆ID获取车辆所在路线经纬度")
    @GetMapping({"getPoint"})
    public BTrackStationDto getPoint(String busId) {
        BTrackStationDto point = this.bBusInfoService.getPoint(busId);
        return point;
    }

    /**
     * 获取车辆经纬度信息
     *
     * @return
     */
    @ApiOperation("获取车辆经纬度信息")
    @GetMapping(value = "getAllPoint")
    List<BBusInfoPo> getAllPoint(){
        List<BBusInfoPo> allPoint = bBusInfoService.getAllPoint();
        return allPoint;
    }
}
