package com.ningdatech.carapi.irs.controller;

import com.ningdatech.carapi.irs.manage.DataInitManage;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ningdatech.carapi.irs.service.CarService;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.io.FileNotFoundException;

/**
 * 车辆违法查询
 *
 * @author CMM
 * @since 2023/04/23 15:18
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/open/api/vehicle/illegal/query")
@RequiredArgsConstructor
public class VehicleIllegalQueryController {

    private final CarService carService;

    private final DataInitManage dataInitManage;

    @ApiOperation(value = "车辆违法查询 测试", notes = "车辆违法查询 测试")
    @GetMapping("/test")
    public String test() {
        return carService.vehicleIllegalQuery();
    }

    @ApiOperation(value = "车辆违法数据初始化", notes = "车辆违法数据初始化")
    @GetMapping("/vehicleIllegalDataInit")
    public String dataInit() {
        return dataInitManage.vehicleIllegaldataInit();
    }

    @ApiOperation(value = "车辆违法数据保存", notes = "车辆违法数据数据保存")
    @GetMapping("/vehicleIllegalDataSave")
    public void dataSave() throws InterruptedException {
        dataInitManage.vehicleIllegalDataSave();
    }

    @ApiOperation(value = "车辆违法查询数据逐个保存", notes = "车辆违法查询数据逐个保存")
    @GetMapping("/illegalDataSingleSave")
    public void illegalDataSingleSave() throws FileNotFoundException {
        dataInitManage.illegalDataSingleSave();
    }

    @ApiOperation(value = "车辆违章数据更新", notes = "车辆违章数据更新")
    @GetMapping("/updateViolationData")
    public void updateViolationData() throws FileNotFoundException {
        dataInitManage.updateViolationData();
    }

}
