package com.ningdatech.carapi.open.controller;

import com.ningdatech.carapi.car.equipment.manage.VehicleEquipmentManage;
import com.ningdatech.carapi.car.equipment.service.INdVehicleEquipmentInfoService;
import com.ningdatech.carapi.car.equipment.model.dto.VehicleEquipmentQueryDTO;
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 java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author PoffyZhang
 * @since 2022-10-09
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/open/api/archives/equipment")
@Api(value = "archives", tags = "车辆管理-档案管理")
@RequiredArgsConstructor
public class OpenApiVehicleEquipmentController {
    private final VehicleEquipmentManage equipmentManage;
    private final INdVehicleEquipmentInfoService vehicleEquipmentInfoService;

    /**
     * 查询车辆设备信息
     * @param id  设备ID
     * @return 查询结果
     */
    @ApiOperation(value = "查询车辆设备信息-以设备ID查询", notes = "查询车辆设备信息-以设备ID查询")
    @GetMapping("/detailsbyId/{id}")
    public VehicleEquipmentQueryDTO getEquipmentById(@PathVariable("id") Long id) {
        return equipmentManage.getEquipmentById(id);
    }

    /**
     * 查询车辆设备信息
     * @param vehicleId  车辆ID
     * @return 查询结果
     */
    @ApiOperation(value = "查询车辆设备信息-以车辆ID查询", notes = "查询车辆设备信息-以车辆ID查询")
    @GetMapping("/detailsbyVehicleId/{vehicleId}")
    public List<VehicleEquipmentQueryDTO> getEquipment(@PathVariable("vehicleId") Long vehicleId) {
        return equipmentManage.getEquipment(vehicleId);
    }
}
