package com.njcn.rdms.module.project.service.workreport.monthly;

import com.njcn.rdms.framework.common.pojo.PageResult;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportApprovalRecordRespVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportApproveReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportDefaultDraftReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportExportVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportPageReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportRefreshDraftReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportRespVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportSaveReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportSignOffConfirmReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.monthly.vo.MonthlyReportSignOffDetailRespVO;
import com.njcn.rdms.module.project.controller.admin.workreport.common.vo.WorkReportStatusActionReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.common.vo.WorkReportStatusLogRespVO;
import com.njcn.rdms.module.project.service.workreport.common.WorkReportCommonService;
import com.njcn.rdms.module.project.service.workreport.defaultdraft.WorkReportDefaultDraftService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MonthlyReportServiceImpl implements MonthlyReportService {

    @Resource
    private WorkReportCommonService workReportCommonService;
    @Resource
    private WorkReportDefaultDraftService workReportDefaultDraftService;

    @Override
    public MonthlyReportRespVO initMonthlyReport() {
        return workReportCommonService.initMonthlyReport();
    }

    @Override
    public MonthlyReportRespVO previewMonthlyDefaultDraft(MonthlyReportDefaultDraftReqVO reqVO) {
        return workReportDefaultDraftService.previewMonthlyDefaultDraft(reqVO);
    }

    @Override
    public MonthlyReportRespVO refreshMonthlyDraft(MonthlyReportRefreshDraftReqVO reqVO) {
        MonthlyReportDefaultDraftReqVO draftReqVO = new MonthlyReportDefaultDraftReqVO();
        draftReqVO.setPeriodKey(reqVO.getPeriodKey());
        draftReqVO.setPeriodLabel(reqVO.getPeriodLabel());
        draftReqVO.setPeriodStartDate(reqVO.getPeriodStartDate());
        draftReqVO.setPeriodEndDate(reqVO.getPeriodEndDate());
        return workReportDefaultDraftService.previewMonthlyDefaultDraft(draftReqVO);
    }

    @Override
    public Long createMonthlyReport(MonthlyReportSaveReqVO reqVO) {
        return workReportCommonService.createMonthlyReport(reqVO, null);
    }

    @Override
    public void updateMonthlyReport(Long id, MonthlyReportSaveReqVO reqVO) {
        workReportCommonService.updateMonthlyReport(id, reqVO);
    }

    @Override
    public MonthlyReportRespVO getMonthlyReport(Long id) {
        return workReportCommonService.getMonthlyReport(id);
    }

    @Override
    public PageResult<MonthlyReportRespVO> getMonthlyReportPage(MonthlyReportPageReqVO reqVO) {
        return workReportCommonService.getMonthlyReportPage(reqVO);
    }

    @Override
    public PageResult<MonthlyReportRespVO> getMonthlyApprovalPage(MonthlyReportPageReqVO reqVO) {
        return workReportCommonService.getMonthlyApprovalPage(reqVO);
    }

    @Override
    public PageResult<MonthlyReportRespVO> getMonthlySignOffPage(MonthlyReportPageReqVO reqVO) {
        return workReportCommonService.getMonthlySignOffPage(reqVO);
    }

    @Override
    public MonthlyReportSignOffDetailRespVO getMonthlySignOffDetail(Long id) {
        return workReportCommonService.getMonthlySignOffDetail(id);
    }

    @Override
    public void submitMonthlyReport(Long id) {
        workReportCommonService.submitMonthlyReport(id);
    }

    @Override
    public void approveMonthlyReport(Long id, MonthlyReportApproveReqVO reqVO) {
        workReportCommonService.approveMonthlyReport(id, reqVO);
    }

    @Override
    public void rejectMonthlyReport(Long id, WorkReportStatusActionReqVO reqVO) {
        workReportCommonService.rejectMonthlyReport(id, reqVO);
    }

    @Override
    public void confirmMonthlySignOff(Long id, MonthlyReportSignOffConfirmReqVO reqVO) {
        workReportCommonService.confirmMonthlySignOff(id, reqVO);
    }

    @Override
    public void deleteMonthlyReport(Long id) {
        workReportCommonService.deleteMonthlyReport(id);
    }

    @Override
    public List<WorkReportStatusLogRespVO> getMonthlyStatusLogs(Long id) {
        return workReportCommonService.getMonthlyStatusLogs(id);
    }

    @Override
    public List<MonthlyReportApprovalRecordRespVO> getMonthlyApprovalRecords(Long id) {
        return workReportCommonService.getMonthlyApprovalRecords(id);
    }

    @Override
    public List<MonthlyReportExportVO> getMonthlyExportList(MonthlyReportPageReqVO reqVO) {
        return workReportCommonService.getMonthlyExportList(reqVO);
    }
}
