package com.bankaudit.rest.process.dao;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.bankaudit.dao.Dao;
import com.bankaudit.dto.DataTableResponse;
import com.bankaudit.dto.EntityAuditDataDto;
import com.bankaudit.dto.process.AuditDto;
import com.bankaudit.process.model.AuditActionItem;
import com.bankaudit.process.model.AuditRating;
import com.bankaudit.process.model.AuditSchedule;
import com.bankaudit.process.model.RiskSummaryDtls;

public interface MyAuditsDao extends Dao {
	DataTableResponse getMuAuditsList(int legalEntityCode,String userId, String search,Integer orderColumn,	String orderDirection, Integer page, Integer size, String role,
			LocalDate financialYear, String auditTypeCode, List<LocalDate>  financialYearStrtEndList);
	
	DataTableResponse  getAuditsForView(int legalEntityCode,String userId, String unitCode, String roleId, String search,Integer orderColumn, String orderDirection, Integer page, Integer size,
			LocalDate financialYear, String auditTypeCode, List<LocalDate>  financialYearStrtEndList);
	
	DataTableResponse  getAuditsForLetter(int legalEntityCode,String userId, String search,Integer orderColumn, String orderDirection, Integer page, Integer size, String role, 
			LocalDate financialYear, String auditTypeCode, List<LocalDate>  financialYearStrtEndList);
	
	DataTableResponse  getMyBranchAudits(int legalEntityCode, String auditId, String unitCode, String userId, String role, String search,Integer orderColumn,String orderDirection, Integer page, Integer size, 
			LocalDate financialYear, String auditTypeCode, List<LocalDate>  financialYearStrtEndList);
	
	AuditSchedule getAuditByPlanIdAndAuditId(int legalEntityCode,String auditTypeCode, String planId,String auditId);
	
	List getRatingAndObsCntGrpSGrpwiseByAuditId(int legalEntityCode,String auditTypeCode, String planId,String auditId); 

	void updateAuditScheduleCounts(AuditSchedule auditSchedule);  
	
	void updateMyAuditStatus(AuditSchedule auditSchedule);
	
	List getAuditsForDashboard(int legalEntityCode,String userId,String role,String period,String fromDate,String toDate);

	DataTableResponse getAdHocAuditsForAuditor(int parseInt, String userId, String search, Integer orderColumn,	String orderDirection, Integer page, Integer size,
			LocalDate financialYear, String auditTypeCode, List<LocalDate>  financialYearStrtEndList); 
	 
	String chkAuditEarlyStartAllowed(AuditSchedule auditSchedule);

	DataTableResponse getAdHocAuditsForManagement(int parseInt, String userId, String search, Integer orderColumn, String orderDirection, Integer page, Integer size,
			LocalDate financialYear, String auditTypeCode, List<LocalDate>  financialYearStrtEndList);
	
	String isAuditObsPendingBfrAuditSubmit(AuditSchedule auditSchedule);
	
	String isAuditObsPending(AuditDto auditDto, String status);

	String isAuditReviewPending(AuditDto auditDto, String status);
	
	List getAuditDetailsForReport(int legalEntityCode,String userId,String role,String auditId,String planId,String auditTypeCode);
	
	List getAuditObservationDetailsForReport(int legalEntityCode,String userId,String role,String auditId,String planId,String auditTypeCode);
	
	Map<String, String> getObsRespRvwCnt(int legalEntityCode, String auditTypeCode, String planId,String auditId); 
	
	Boolean getFetchObservationsExtrnlAndInsertInternal(int legalEntityCode,String userId,String unitId,String auditId,String planId,String auditTypeCode);
	
	String getAlreadyFetchObsStatus(int legalEntityCode,String userId,String auditId,String planId,String auditTypeCode);
	
	DataTableResponse  getAuditsOnDashboard(int legalEntityCode,String userId, String search,Integer orderColumn,
			String orderDirection, Integer page, Integer size, String auditStatus, String auditTypeCode, String unitsList, 
			List unitsList1,LocalDate fromDate,LocalDate toDate,List auditList);
	
	List getWatchListForAudits(int legalEntityCode, String auditTypeCode,LocalDate startDate);
	
	List<RiskSummaryDtls> getRiskCntByBusinssAndProdByMapping(int legalEntityCode,String auditTypeCode, String planId,String auditId, String auditStatus);
	List<RiskSummaryDtls> getRiskCntByBusinssAndProdByRiskId(int legalEntityCode,String auditTypeCode, String planId,String auditId, String auditStatus);
	
	boolean isPreviousAuditExist(int legalEntityCode,String unitId,String auditTypeCode,String auditId);
	
	void updateAuditTeamStatus(AuditSchedule auditSchedule);
	
	List<RiskSummaryDtls> getObservationCntByAgAsgActByMapping(int legalEntityCode,String auditTypeCode, String planId,String auditId, String auditStatus);
	
	List<RiskSummaryDtls> getObservationCntByAgAsgActByAuditId(int legalEntityCode,String auditTypeCode, String planId,String auditId, String auditStatus);
	
	List<RiskSummaryDtls> getObservationCntByAgAsgActByAuditIdResponse(int legalEntityCode,String auditTypeCode, String planId,String auditId, String auditStatus);
	
	List<RiskSummaryDtls> getObservationCntByAgAsgActByAuditIdReview(int legalEntityCode,String auditTypeCode, String planId,String auditId, String auditStatus);
	
	List<RiskSummaryDtls> getObservationCntByAuditIdReview(int legalEntityCode, String auditTypeCode, String planId,String auditId, String auditStatus); // for BAAS implementation
	
	void updateReportStatus(AuditSchedule auditSchedule);
	
	String updateReportStatus(AuditDto auditDto);
	
	AuditSchedule getAuditDetailsByPlanIdAndAuditId(int legalEntityCode,String auditTypeCode, String planId,String auditId);
	
	AuditSchedule getFYAndAuditSerialNoBfrInitiate(int legalEntityCode, String auditId,String letterCode, String unitCode, String auditTypeCode, Date schStartDate, String auditStatus); // To get the FY and Audit SerialNo before Initiate

	List<AuditSchedule> getAuditsForNotification(int legalEntityCode,String auditTypeCode, String userId, String notificatioNtype);
	
	String getAuditSerialNoBfrInitiate(int legalEntityCode, String auditId,String letterCode, String unitCode, String auditTypeCode);
	
	//void updateMyAuditRatingParameterStatus(int legalEntityCode, String auditId, String ratingParamMaker, String ratingParamReviewer, String ratingParameterStatus);
	void updateMyAuditRatingParameterStatus(AuditSchedule auditSchedule);
	
	void updateMyAuditRatingComplianceObsScoreStatus(AuditSchedule auditSchedule);
	
	AuditSchedule getAuditByAuditId(int legalEntityCode, String auditTypeCode, String planId, String auditId);
	
	AuditSchedule getAuditByAuditId(int legalEntityCode, String auditTypeCode, String auditId);
	
	AuditRating getAuditRatingByAuditId(int legalEntityCode, String auditTypeCode, String auditId);
	
	void updateAuditRatingStatus(AuditSchedule auditSch, String ratingParameterStatus);
	
	EntityAuditDataDto getEntityAuditData(int legalEntityCode, String auditTypeCode, String auditId, String unitId);
	
	List<AuditSchedule> getAuditSchedules(Integer legalEntityCode, String auditTypeCode);
	
	List<AuditActionItem> getAuditActionItem(Integer legalEntityCode, String auditTypeCode, String auditId);
	void saveAuditActionItem(Integer legalEntityCode, String auditTypeCode, String auditId);
	
	AuditSchedule checkLatestITISAuditDetailsForUnit(Integer legalEntityCode, String unitId);
	
	String getFinancialYearByAuditId(Integer legalEntityCode, String auditTypeCode, String auditId);
	
}
