package com.njcn.rdms.module.project.controller.admin.overtime.team;

import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.project.constant.OvertimeApplicationConstants;
import com.njcn.rdms.module.project.controller.admin.overtime.team.vo.TeamOvertimeSummaryReqVO;
import com.njcn.rdms.module.project.controller.admin.overtime.team.vo.TeamOvertimeSummaryRespVO;
import com.njcn.rdms.module.project.service.overtime.team.TeamOvertimeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
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 static com.njcn.rdms.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 团队业务学习")
@RestController
@RequestMapping("/project/overtime-applications/team")
@Validated
public class TeamOvertimeController {

    @Resource
    private TeamOvertimeService teamOvertimeService;

    @GetMapping("/summary")
    @Operation(summary = "获取团队业务学习统计")
    @PreAuthorize("@ss.hasPermission('" + OvertimeApplicationConstants.PERMISSION_TEAM_DASHBOARD + "')")
    public CommonResult<TeamOvertimeSummaryRespVO> getSummary(@Valid TeamOvertimeSummaryReqVO reqVO) {
        return success(teamOvertimeService.getSummary(reqVO));
    }
}
