package com.xindazhou.vehicle.api;

import com.xindazhou.framework.common.pojo.CommonResult;
import com.xindazhou.vehicle.api.dto.VehicleRespDTO;
import com.xindazhou.vehicle.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 车辆信息 API
 *
 * @author xindazhou
 */
@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - 车辆信息")
public interface VehicleApi {

    String PREFIX = "/rpc-api/vehicle";

    @GetMapping(PREFIX + "/get")
    @Operation(summary = "获取车辆信息")
    @Parameter(name = "id", description = "车辆编号", required = true, example = "1")
    CommonResult<VehicleRespDTO> getVehicle(@RequestParam("id") Long id);

    @GetMapping(PREFIX + "/get-by-vin")
    @Operation(summary = "根据 VIN 码获取车辆信息")
    @Parameter(name = "vin", description = "VIN 码", required = true, example = "LSGBF533XFH123456")
    CommonResult<VehicleRespDTO> getVehicleByVin(@RequestParam("vin") String vin);

    @GetMapping(PREFIX + "/list-by-user-id")
    @Operation(summary = "获取用户绑定的车辆列表")
    @Parameter(name = "userId", description = "用户编号", required = true, example = "1024")
    @Parameter(name = "userType", description = "用户类型", required = true, example = "1")
    CommonResult<List<VehicleRespDTO>> listVehicleByUserId(@RequestParam("userId") Long userId,
                                                           @RequestParam("userType") Integer userType);

}

