package com.ningdatech.carapi.driver.controller;

import com.ningdatech.carapi.common.model.DataChartVo;
import com.ningdatech.carapi.common.model.MapDataVO;
import com.ningdatech.carapi.common.util.CodeUtil;
import com.ningdatech.carapi.driver.manage.DriverManageDataViewManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * DriverManageDataViewController
 * </p>
 *
 * @author WendyYang
 * @since 15:28 2022/10/26
 */
@AllArgsConstructor
@RestController
@Api(tags = "驾驶员管理-数据大屏")
@RequestMapping("/api/v1/driver-manage/data-view")
public class DriverManageDataViewController {

    private final DriverManageDataViewManage driverManageDataViewManage;

    @ApiOperation("驾驶员比例/驾驶员分布")
    @GetMapping("/driverStatisticsByRegion/{regionId}")
    public List<MapDataVO> driverStatisticsByRegion(@PathVariable Long regionId) {
        regionId = CodeUtil.convertRegionCodeToId(regionId);
        return driverManageDataViewManage.driverStatisticsByRegion(regionId);
    }

    @ApiOperation("驾驶员年龄统计")
    @GetMapping("/driverAgeStatisticsByRegion/{regionId}")
    public List<DataChartVo> driverAgeStatisticsByRegion(@PathVariable Long regionId) {
        regionId = CodeUtil.convertRegionCodeToId(regionId);
        return driverManageDataViewManage.driverAgeStatisticsByRegion(regionId);
    }

    @ApiOperation("驾驶员驾龄统计")
    @GetMapping("/drivingExperienceStatisticsByRegion/{regionId}")
    public List<DataChartVo> drivingExperienceStatisticsByRegion(@PathVariable Long regionId) {
        regionId = CodeUtil.convertRegionCodeToId(regionId);
        return driverManageDataViewManage.drivingExperienceStatisticsByRegion(regionId);
    }

    @ApiOperation("驾驶员籍贯统计")
    @GetMapping("/driverNativePlaceStatisticsByRegion/{regionId}")
    public List<MapDataVO> driverNativePlaceStatisticsByRegion(@PathVariable Long regionId) {
        regionId = CodeUtil.convertRegionCodeToId(regionId);
        return driverManageDataViewManage.driverNativePlaceStatisticsByRegion(regionId);
    }

}
