package com.ningdatech.carapi.open.controller;

import com.ningdatech.carapi.car.position.model.po.ReqDataPO;
import com.ningdatech.carapi.car.vehicle.manage.VehicleManage;
import com.ningdatech.carapi.car.vehicle.model.vo.VehicleBaseVO;
import com.ningdatech.carapi.car.vehicle.model.vo.VehicleCarPlateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

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

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author PoffyZhang
 * @since 2022-10-09
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/open/api/vehicle/")
@Api(value = "archives", tags = "对外联调接口")
@RequiredArgsConstructor
public class OpenApiVehicleController {

    private final VehicleManage vehicleManage;

    @ApiOperation(value = "用公司ID去查车牌号", notes = "用公司ID去查车牌号")
    @GetMapping("/list-by-companyIds")
    public List<VehicleCarPlateVO> listByCompanyIds(@Valid @RequestParam("companyIds") List<String> companyIds) {
        return vehicleManage.listByCompanyIds(companyIds);
    }

    @ApiOperation(value = "用批量车牌号去查车辆信息", notes = "用批量车牌号去查车辆信息")
    @PostMapping("/list-by-carplate")
    public List<VehicleBaseVO> listByCarplate(@Valid @RequestBody ReqDataPO po) {
        return vehicleManage.listByCarplate(po);
    }
}
