package com.sckw.transport.api.feign;

import com.sckw.core.web.response.BaseIotResult;
import com.sckw.core.web.response.BaseResult;
import com.sckw.transport.api.model.dto.VehicleDataDTO;
import com.sckw.transport.api.model.dto.VehicleReturnData;
import com.sckw.transport.api.model.vo.VehicleTraceResponse;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 车辆轨迹服务 Feign 客户端
 * 调用数据中台的车辆轨迹接口
 * @author system
 * @date 2024
 */
@FeignClient(
    name = "iot-platform",
    url = "${vehicle.trace.api.base-url}/api/transfer",
   // path = "/api/transfer",
    configuration = VehicleTraceFeignConfig.class
)
@ConditionalOnProperty(name = "vehicle.trace.api.base-url")
public interface VehicleTraceClient {

    /**
     * 查询实时位置
     * @param vehicleDataDTO 车辆数据
     * @return 车辆位置信息
     */
    @PostMapping("/queryRealTimeLocation")
    BaseIotResult<VehicleReturnData> queryRealTimeLocation(@RequestBody VehicleDataDTO vehicleDataDTO);

    /**
     * 查询车辆轨迹列表
     * @param vehicleDataDTO 车辆数据
     * @return 车辆轨迹列表
     */
    @PostMapping("/queryVehicleDataList")
    BaseIotResult<List<VehicleReturnData>> queryVehicleDataList(@RequestBody VehicleDataDTO vehicleDataDTO);

    /**
     * 上报车辆轨迹
     * @param request 车辆轨迹数据
     * @return 上报结果
     */
    @PostMapping("/saveVehicleData")
    BaseIotResult<Void> saveVehicleData(@RequestBody Object request);
}
