package com.bankaudit.rest.process.dao;

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

import com.bankaudit.dao.Dao;
import com.bankaudit.dto.DashboardDto;
import com.bankaudit.dto.DataTableResponse;
import com.bankaudit.dto.process.AuditStatusGraphResponseDto;
import com.bankaudit.dto.process.BranchPerformanceBUResponse;
import com.bankaudit.dto.process.BranchPerformanceResponseDto;
import com.bankaudit.dto.process.DashboardSummaryDto;
import com.bankaudit.dto.process.PlanCalendarResponseDto;
import com.bankaudit.dto.process.RatingVarianceGraphResponseDto;
import com.bankaudit.dto.process.RealTimeRectificationResponseDto;
import com.bankaudit.dto.process.ScheduleVarianceGraphResponseDto;
import com.bankaudit.dto.process.UnitBreakUpResponseDto;
import com.bankaudit.model.MaintUsergroupRoles;
import com.bankaudit.model.User;
import com.bankaudit.process.model.AuditReportDynamicTable;
import com.bankaudit.process.model.AuditSchedule;

public interface DashboardDao extends Dao {


	List<AuditStatusGraphResponseDto> getAuditStatusQuarterly(Integer legalEntityCode, String auditType,
			String unitType, String criticality, String userId, Date businessDate, String role, List<String> unitList);
	
	List<AuditStatusGraphResponseDto> getAuditStatusHalfYearly(Integer legalEntityCode, String auditType,
			String unitType, String criticality, String userId, Date businessDate, String role, List<String> unitList);
	
	List<AuditStatusGraphResponseDto> getAuditStatusYearly(Integer legalEntityCode, String auditType,
			String unitType, String criticality, String userId, Date businessDate, String role, List<String> unitList);

	List<AuditStatusGraphResponseDto> getAuditStatusByRange(Integer legalEntityCode, String auditType, String unitType,
			String criticality, String userId, LocalDate fromDate, LocalDate toDate, String role, List<String> unitList);

	DataTableResponse getAuditSchedules(int parseInt, String userId, String search, Integer orderColumn,
			String orderDirection, Integer page, Integer size, String role, List<String> unitList);

	List<ScheduleVarianceGraphResponseDto> getScheduleVariance(int legalEntityCode, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role, List<String> unitList, String unitType, String criticality);

	List<ScheduleVarianceGraphResponseDto> getScheduleDelay(int legalEntityCode, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role, List<String> unitList, String unitType, String criticality);

	List<RealTimeRectificationResponseDto> getRealTimeRectification(int legalEntityCode, String auditType,
			String period, LocalDate fromDate, LocalDate toDate, String userId, String role, List<String> unitList, String unitType, String criticality);

	List<RatingVarianceGraphResponseDto> getRatingStatus(int legalEntityCode, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role, List<String> unitList, List<String> auditsList, String unitType, String criticality);
	
	List<Map<String, HashMap<String,Long>>> getRatingVariance(int parseInt, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,List<String> unitList,List<String> auditsList, String unitType, String criticality);
	
	List<AuditStatusGraphResponseDto> getMyAuditStatistics(Integer legalEntityCode, String auditType, String unitType,
			String criticality, String userId, Date businessDate);

	BranchPerformanceResponseDto getBranchPerformance(int legalEntityCode, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role, List<String> unitList, String unitType, String criticality);

	AuditSchedule getLatestAuditId(int legalEntityCode, String auditTypeCode, String unitCode);

	List<BranchPerformanceBUResponse> getBranchPerformanceForBU(int legalEntityCode, List<String> auditTypes, String userId,
			String role, List<String> planIds, List<String> auditIds);

	List<UnitBreakUpResponseDto> getUnitBreakUp(int parseInt, String auditType, String unitType, String period, LocalDate fromDate,
			LocalDate toDate, String role, String userId);
	
	List<UnitBreakUpResponseDto> getUnitBreakUpCriticalityWise(int parseInt, String auditType, String unitType, String period, LocalDate fromDate,
			LocalDate toDate, String role, String userId, String criteria);
			
	List<UnitBreakUpResponseDto> getUnitBreakUpUnitTypeClassificatioWise(int parseInt, String auditType, String unitType, String period, LocalDate fromDate,
			LocalDate toDate, String role, String userId, String criteria);
	
	List<UnitBreakUpResponseDto> getUnitBreakUpRevenueWsie(int parseInt, String auditType, String unitType, String period, LocalDate fromDate,
			LocalDate toDate, String role, String userId, String criteria, List<String> auditsList);
	

	List<PlanCalendarResponseDto> getPlanCalendar(int parseInt,LocalDate financialYearStartDate);
	
	List<String> getAuditTypes(int legalEntityCode);
	
	String getFinYrEndDate(int legalEntityCode);
	
	String getNextPlanStartdate(int legalEntityCode,String auditType);
	
	List<User> getListofAuditors(int legalEntityCode,String auditType);
	
	int getUnitWorkingDays(int legalEntityCode , String unitCode, String startDate, String endDate);
	
	int getEffortUtilized(int legalEntityCode , String startDate, Map<String, String> nextPlanStartDateMap, String finYrEndDate);
	
	String getHeadOfficeUnitCode(int legalEntityCode);
	
	List<AuditSchedule> getAuditSummary(int legalEntityCode, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role, List<String> unitList, String unitType, String criticality);
	
	List<BranchPerformanceBUResponse> getBranchPerformanceRectification(int parseInt, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,  String criticality);
	
	List<Map<String, Map<String,Long>>> getRatingTrendQuarterly(int parseInt, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,List<String> unitList, String unitType, String criticality, Date businessDate);
	
	List<Map<String, Map<String,Long>>> getRatingTrendHalfYearly(int parseInt, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,List<String> unitList, String unitType, String criticality, Date businessDate);
	
	List<Map<String, Map<String,Long>>> getRatingTrendYearly(int parseInt, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,List<String> unitList, String unitType, String criticality, Date businessDate);
	
	List<String> getUnitsSpecificToAudit(int legalEntityCode,String auditType,List<String> unitList,String jurisdictionYorN);
	
	List<String> getLatestAuditsToUnits(int legalEntityCode,String auditType,List<String> unitsSpecificToAuditList,String role, String jurisdictionYorN);
	
	List<String> getLatestByDateAuditsToUnits(int legalEntityCode,String auditType,List<String> unitsSpecificToAuditList,String role, String jurisdictionYorN , LocalDate byDate);
	
	List<String> getUnitsOpenByDateList(int legalEntityCode,String auditType,List<String> unitsSpecificToAuditList,LocalDate byDate);
	
	List<Map<String,Long>> getRatingCountByDateForTrend(int legalEntityCode, String auditType,String role,List<String> unitList,List<String> auditsList, String unitType,String criticality);
	
	Map<String, Integer>  getUserDtlsforAdminDB(int legalEntityCode,String userId,String role, Date businessDate);
	
//	List<Map<String, Map<String,Long>>> getRatingTrendRange(int parseInt, String auditType, String period,
//			LocalDate fromDate, LocalDate toDate, String userId, String role,List<String> unitList, String unitType, String criticality, Date businessDate);
	
	LocalDate getFinancialYearStartDate(Integer legalEntityCode);
	
	LocalDate getFinancialYearEndDate(Integer legalEntityCode);
	
	List<MaintUsergroupRoles> getRolewiseUsersCount(int legalEntityCode,String userId,String role); 
	
	Map<String, Integer> getTargetUnitAuditsUnitCount(int legalEntityCode, String unitsLst, String auditTypeCode,String startDate,String endDate);
	
	int getWatchListForAudits(int legalEntityCode, String auditTypeCode,String startDate);
	
	List<AuditStatusGraphResponseDto> getAuditClosureStatusQuarterly(Integer legalEntityCode, String auditType,
			String unitType, String criticality, String userId, Date businessDate, String role, List<String> unitList);
	
	List<AuditStatusGraphResponseDto> getAuditClosureStatusHalfYearly(Integer legalEntityCode, String auditType,
			String unitType, String criticality, String userId, Date businessDate, String role, List<String> unitList);
	
	List<AuditStatusGraphResponseDto> getAuditClosureStatusYearly(Integer legalEntityCode, String auditType,
			String unitType, String criticality, String userId, Date businessDate, String role, List<String> unitList);
	
	List<AuditStatusGraphResponseDto> getAuditClosureStatusByRange(Integer legalEntityCode, String auditType, String unitType,
			String criticality, String userId, LocalDate fromDate, LocalDate toDate, String role, List<String> unitList);
	
	List<List> getAuditClosureStatusYearlyTmp(Integer legalEntityCode, String auditType,
			String unitType, String criticality, String userId, Date businessDate, String role, List<String> unitList);
	
	Map<String, String>  getAssessmentSummaryDtls(int legalEntityCode,String userOrUnitCode,String type,String role, String auditTypeCode, Boolean isDeptAsRMD, List<String> deptList);
	
	List< HashMap<String,String>> getRiskProfileDeptwise(int legalEntityCode,  String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,Boolean isDeptAsRMD, List<String> unitList, List<String> deptList);
	
	List< HashMap<String,String>> getRiskProfileProductwise(int legalEntityCode,  String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,Boolean isDeptAsRMD, List<String> unitList, List<String> deptList);
	
	List<String> getDeptList(Integer legalEntityCode ,String role,String userIdOrUnitId );
	
	List< HashMap<String,String>> getControlProfileDeptwise(int parseInt, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,Boolean isDeptAsRMD, List<String> unitList, List<String> deptList);
	
	List< HashMap<String,String>> getControlProfileProductwise(int parseInt, String auditType, String period,
			LocalDate fromDate, LocalDate toDate, String userId, String role,Boolean isDeptAsRMD, List<String> unitList, List<String> deptList);
	
	Map<String, Integer>  getTaskStatistics(int legalEntityCode,String userId,String role, String auditType, String unitId, Boolean isDeptAsRMD, List<String> deptList ,List<String> unitList );
	
	Map<String, Integer>  getOverDueTaskStatistics(int legalEntityCode,String userId,String role, String auditType, String unitId, Boolean isDeptAsRMD, List<String> deptList ,List<String> unitList );
	
	Map<String, String>  getHealthControlRiskSummaryDetails(int legalEntityCode,String userId,String role, String auditType, String unitId, Boolean isDeptAsRMD, List<String> deptList ,List<String> unitList );

	int getRCSAUnitsCount(int legalEntityCode,String userOrUnitCode,String type,String role, String auditTypeCode, Boolean isDeptAsRMD, List<String> deptList);
	
	Boolean isAssessmentProcessDoneFY(int legalEntityCode, LocalDate currFYStartDate, LocalDate currFYEndDate);
	
	/******************** New BaaSDos Dashboard implementation start ********************/	
	
	Map<String, Integer> getDeskComplianceRatingWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearList);
	
	Map<String, Integer> getSupervisoryRatingWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearList);
	
	Map<String, Map<String, String>> getSupervisoryRatingMigrationWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearList);
	
	Map<String, String> getBudgetProgressWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearList);
	
	Map<String, String> getComplianceStatusWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearList);
	
	 Map<String, Map<String, Integer>> getFinancialParameterWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
				String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearList);
	
	Map<String, Integer> getMyInspectionWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<LocalDate>  financialYearList);
	
	List<AuditReportDynamicTable> getDynamicTableInstances(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<LocalDate>  financialYearList);
	
	Map<String, Map<String, String>> getMyBudgetWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<LocalDate>  financialYearList);
	
	Map<String, String> getTopBandWidget(Integer legalEntityCode,  LocalDate financialYear,  String auditTypeCode, 
			  String unitId, List<LocalDate>  financialYearList);
	
	DataTableResponse getMyAuditSchedules(Integer legalEntityCode, String userId, String search, Integer orderColumn,
			String orderDirection, Integer page, Integer size,  String role);
	
	List<DashboardDto> getNonComplianceItemWidgetYearWise(Integer legalEntityCode, String userId,  String role, LocalDate financialYear,
			String unitId, List<LocalDate>  financialYearList);
	
	List<DashboardDto> getComplianceSubmittedWidgetYearWise(Integer legalEntityCode, String userId,  String role, LocalDate financialYear,
			String unitId, List<LocalDate>  financialYearList);
	
	List<DashboardDto> getPlanCalendarWidget(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist);
	
	List<DashboardDto> getScrutinyStatusWidget(Integer legalEntityCode, String userId,  String role, LocalDate financialYear,
			String unitId, List<LocalDate>  financialYearList);
	
	Integer getWatchListForAudits(Integer legalEntityCode,  LocalDate financialYear,  String auditTypeCode,  String unitId);
	
	List<String> getUnitCodeList(Integer legalEntityCode, String unitId, String zone);
	
	Map<String, String> getAuthorizedLettersCount(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearLsit);
	
	Map<String, String> getUnAuthorizedLettersCount(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearLsit);
	
	Map<String, String> getAuthorizedSupportingDocumentCount(Integer legalEntityCode, String userId, String role, LocalDate financialYear,  String auditTypeCode, 
			String zone, String unitId, List<String> unitIdlist, List<LocalDate>  financialYearLsit);
}
