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

import com.njcn.rdms.framework.common.pojo.PageResult;
import com.njcn.rdms.module.project.controller.admin.workreport.weekly.vo.WeeklyReportExportVO;
import com.njcn.rdms.module.project.controller.admin.workreport.weekly.vo.WeeklyReportDefaultDraftReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.weekly.vo.WeeklyReportPageReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.weekly.vo.WeeklyReportRefreshDraftReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.weekly.vo.WeeklyReportRespVO;
import com.njcn.rdms.module.project.controller.admin.workreport.weekly.vo.WeeklyReportSaveReqVO;
import com.njcn.rdms.module.project.controller.admin.workreport.common.vo.WorkReportApprovalRecordRespVO;
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.defaultdraft.WorkReportDefaultDraftService;
import com.njcn.rdms.module.project.service.workreport.common.WorkReportCommonService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WeeklyReportServiceImpl implements WeeklyReportService {

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

    @Override
    public WeeklyReportRespVO initWeeklyReport() {
        return workReportCommonService.initWeeklyReport();
    }

    @Override
    public WeeklyReportRespVO previewWeeklyDefaultDraft(WeeklyReportDefaultDraftReqVO reqVO) {
        return workReportDefaultDraftService.previewWeeklyDefaultDraft(reqVO);
    }

    @Override
    public WeeklyReportRespVO refreshWeeklyDraft(WeeklyReportRefreshDraftReqVO reqVO) {
        WeeklyReportDefaultDraftReqVO draftReqVO = new WeeklyReportDefaultDraftReqVO();
        draftReqVO.setPeriodKey(reqVO.getPeriodKey());
        draftReqVO.setPeriodLabel(reqVO.getPeriodLabel());
        draftReqVO.setPeriodStartDate(reqVO.getPeriodStartDate());
        draftReqVO.setPeriodEndDate(reqVO.getPeriodEndDate());
        return workReportDefaultDraftService.previewWeeklyDefaultDraft(draftReqVO);
    }

    @Override
    public Long createWeeklyReport(WeeklyReportSaveReqVO reqVO) {
        return workReportCommonService.createWeeklyReport(reqVO, null);
    }

    @Override
    public void updateWeeklyReport(Long id, WeeklyReportSaveReqVO reqVO) {
        workReportCommonService.updateWeeklyReport(id, reqVO);
    }

    @Override
    public WeeklyReportRespVO getWeeklyReport(Long id) {
        return workReportCommonService.getWeeklyReport(id);
    }

    @Override
    public PageResult<WeeklyReportRespVO> getWeeklyReportPage(WeeklyReportPageReqVO reqVO) {
        return workReportCommonService.getWeeklyReportPage(reqVO);
    }

    @Override
    public PageResult<WeeklyReportRespVO> getWeeklyApprovalPage(WeeklyReportPageReqVO reqVO) {
        return workReportCommonService.getWeeklyApprovalPage(reqVO);
    }

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

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

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

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

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

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

    @Override
    public List<WeeklyReportExportVO> getWeeklyExportList(WeeklyReportPageReqVO reqVO) {
        return workReportCommonService.getWeeklyExportList(reqVO);
    }
}
