package com.hotwj.platform.workbench.controller;

import com.hotwj.platform.workbench.domain.vo.*;
import com.hotwj.platform.workbench.service.IWorkbenchService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 企业端首页
 *
 * @author shihongwei
 * @date 2026-02-24
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/workbench")
@Tag(name = "企业端首页", description = "企业端首页通知统计模块")
public class WorkbenchController extends BaseController {

    private final IWorkbenchService workbenchService;

    /**
     * 获取公司基本信息
     */
    @GetMapping("/company/basicInfo")
    @Operation(summary = "获取公司基本信息")
    public R<CompanyBasicInfoVo> getCompanyBasicInfo() {
        return R.ok(workbenchService.getCompanyBasicInfo());
    }


    // 风险提醒模块
    @GetMapping("/riskReminder")
    @Operation(summary = "获取风险提醒信息")
    public R<RiskReminderVo> getRiskReminder() {
        return R.ok(workbenchService.getRiskReminder());
    }

    /**
     * 获取快捷入口统计
     */
    @GetMapping("/shortcutStatistics")
    @Operation(summary = "获取快捷入口统计")
    public R<ShortcutStatisticsVo> getShortcutStatistics() {
        return R.ok(workbenchService.getShortcutStatistics());
    }

    /**
     * 获取隐患排查统计
     */
    @GetMapping("/hiddenDangerStats")
    @Operation(summary = "获取隐患排查统计")
    public R<HiddenDangerStatsVo> getHiddenDangerStats() {
        return R.ok(workbenchService.getHiddenDangerStats());
    }

    /**
     * 获取学习折线图数据
     */
    @GetMapping("/learningStats")
    @Operation(summary = "获取学习折线图数据")
    public R<List<LearningStatsItemVo>> getLearningStats(
            @RequestParam(required = false) String type,
            @RequestParam(required = false) String beginTime,
            @RequestParam(required = false) String endTime) {
        return R.ok(workbenchService.getLearningStats(type, beginTime, endTime));
    }

    /**
     * 获取培训使用情况
     */
    @GetMapping("/trainingUsage")
    @Operation(summary = "获取培训使用情况")
    public R<TrainingUsageVo> getTrainingUsage() {
        return R.ok(workbenchService.getTrainingUsage());
    }

    /**
     * 获取车辆/驾驶员总数比例
     */
    @GetMapping("/vehicleDriverRatio")
    @Operation(summary = "获取车辆/驾驶员总数比例")
    public R<VehicleDriverRatioVo> getVehicleDriverRatio() {
        return R.ok(workbenchService.getVehicleDriverRatio());
    }
}
