package com.xindazhou.vehicle.api;

import com.xindazhou.framework.common.pojo.CommonResult;
import com.xindazhou.vehicle.api.dto.bind.VehicleBindReqDTO;
import com.xindazhou.vehicle.api.dto.bind.VehicleBindRespDTO;
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.*;

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

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

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

    @PostMapping(PREFIX + "/bind")
    @Operation(summary = "绑定车辆")
    CommonResult<Long> bindVehicle(@Valid @RequestBody VehicleBindReqDTO reqDTO);

    @DeleteMapping(PREFIX + "/unbind")
    @Operation(summary = "解绑车辆")
    @Parameter(name = "id", description = "绑定关系编号", required = true, example = "1")
    CommonResult<Boolean> unbindVehicle(@RequestParam("id") Long id);

    @GetMapping(PREFIX + "/get-by-vehicle-id")
    @Operation(summary = "获取车辆的所有绑定关系")
    @Parameter(name = "vehicleId", description = "车辆编号", required = true, example = "1")
    CommonResult<List<VehicleBindRespDTO>> listBindByVehicleId(@RequestParam("vehicleId") Long vehicleId);

    @GetMapping(PREFIX + "/get-by-user-id")
    @Operation(summary = "获取用户的所有绑定关系")
    @Parameter(name = "userId", description = "用户编号", required = true, example = "1024")
    @Parameter(name = "userType", description = "用户类型", required = true, example = "1")
    CommonResult<List<VehicleBindRespDTO>> listBindByUserId(@RequestParam("userId") Long userId,
                                                             @RequestParam("userType") Integer userType);

}

