package com.njcn.rdms.module.project.controller.admin.workreport.common;

import com.njcn.rdms.framework.common.pojo.CommonResult;
import com.njcn.rdms.module.project.constant.WorkReportConstants;
import com.njcn.rdms.module.project.controller.admin.workreport.common.vo.WorkReportStatusDictRespVO;
import com.njcn.rdms.module.project.service.workreport.common.WorkReportStatusService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
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 java.util.List;

import static com.njcn.rdms.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 工作报告状态")
@RestController
@RequestMapping("/project/work-reports")
@Validated
public class WorkReportStatusController {

    @Resource
    private WorkReportStatusService workReportStatusService;

    @GetMapping("/status/dict")
    @Operation(summary = "获取工作报告所有状态字典")
    @PreAuthorize("@ss.hasPermission('" + WorkReportConstants.PERMISSION_QUERY + "')")
    public CommonResult<List<WorkReportStatusDictRespVO>> getStatusDict() {
        return success(workReportStatusService.getStatusDict());
    }
}
