package com.xdap.self_development.service;

import com.definesys.mpaas.query.db.PageQueryResult;
import com.xdap.self_development.controller.form.*;
import com.xdap.self_development.domain.dto.ApprovalNodesDTO;
import com.xdap.self_development.domain.pojo.ApprovalConfigPojo;
import com.xdap.self_development.domain.pojo.ApprovalFlowPojo;
import com.xdap.self_development.domain.pojo.ApprovalRecordPojo;
import com.xdap.self_development.domain.pojo.BenchmarkingReportPojo;
import com.xdap.self_development.domain.view.ApprovalFlowNodeView;
import com.xdap.self_development.domain.view.TodoAndReportListView;
import com.xdap.self_development.domain.view.TodoAndReportView;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

public interface BenchmarkingReportService {
    PageQueryResult<TodoAndReportView> getBenchmarkingReportByCondition(
            @Valid BenchmarkingReportPageForm form);

    void insertReport(@Valid SaveBenchmarkingReportForm form);

    void startReportApproval(ApprovalPersonForm form);

    void continueApproval(@NotBlank String flowId, @NotBlank String userId);

    void restartReportApproval(@Valid RestartReportApprovalForm form);

    void directSendingApproval(@NotBlank String reportId, @NotBlank String userId);

    void handleReturnToNode(@Valid HandleReturnNodeForm form);

    void handleReturn(@Valid HandleApprovalRequest request);

    void deleteReport(@NotBlank String reportId);

    void updateReport(@Valid UpdateBenchmarkingReportForm form);
    
    void handleReportApproval(@Valid HandleApprovalRequest request);

    BenchmarkingReportPojo getReportDetail(@NotBlank String reportId);

    ApprovalFlowNodeView getReportProcess(@NotBlank String flowId);

    String uploadFile(MultipartFile file, @NotBlank String createBy);

    PageQueryResult<TodoAndReportListView> getApprovalList(@Valid ApprovalListForm form);

    void processNextNode(ApprovalFlowPojo flow, ApprovalConfigPojo currentNode, String userId);

    void processApprovalLogic(ApprovalFlowPojo flow, HandleApprovalRequest request, ApprovalConfigPojo currentNode, ApprovalRecordPojo lastedRecord);

    void addNodeTodo(ApprovalFlowPojo flow, ApprovalConfigPojo node, BenchmarkingReportPojo report, String createBy, Integer enableReturn);

    void cancelProcess(ApprovalFlowPojo flow, ApprovalConfigPojo node, String status, String userId);

    void updateTasks(ApprovalFlowPojo flow, String status, Integer enableReturn, ApprovalConfigPojo currentNode);

    ApprovalNodesDTO getApprovalUsers(@NotBlank String flowId);

}
