package com.bankaudit.rest.process.dao;

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

import org.hibernate.Session;

import com.bankaudit.dao.Dao;
import com.bankaudit.dto.DataTableResponse;
import com.bankaudit.process.model.AdhocPlanFinalV;
import com.bankaudit.process.model.AuditPlan;
import com.bankaudit.process.model.AuditPlanV;
import com.bankaudit.process.model.AuditPlanWrk;
import com.bankaudit.process.model.AuditProcessV;
import com.bankaudit.process.model.AuditProcessValidate;
import com.bankaudit.process.model.AuditTeam;

/**
 * 
 * @author narendar.burada
 *
 */
public interface AuditProcessVDao  extends  Dao{
	
	
	List<AuditProcessV> getAuditProcessByAuditPlan(int legalEntityCode,String auditType,String psDate,String peDate,String maker) ;
	//List<AuditProcessV> getAuditProcessByAuditPlan(int legalEntityCode,String auditType,String planEndDate);
	//List<AuditProcessV>  getAuditProcessAsPerFrequnacy(String planStartDate,String planEndDate,List<AuditProcessV> apv);
	//List<AuditProcessV>  checkAndsetStartDateforAuditProcess(List<AuditProcessV> apl,String planStartDate,String planEndDate);
	
	List<AuditPlanV> getAuditProcessNextPlan(int legalEntityCode,String auditTypeCode) ;
	List getauditProcessTeam(int legalEntityCode,String auditType,String userId); 
	// List<AuditschedulesV>  getAuditSchedules(int legalEntityCode);
	 DataTableResponse getAuditSchedules(int legalEntityCode,String search,Integer orderColumn,	String orderDirection, Integer page, Integer size,String maker,String planType);
	 Map<String, String> isValiedBusinessDate(String legalEntityCode,String unitId,String frequency,int duration,String currStartDate,String currEndDate,String plnStDate,String plnEnDate);
	void deleteAuditPlanTemp(int legalEntityCode,String maker);
	List<AuditProcessValidate> validateAuditProcess(int legalEntityCode,String auditType,Date psDate,Date peDate,String planId,String maker);
	List<AuditProcessValidate> getValidateAuditProcess(int legalEntityCode,String auditTypeCode);
	void createAuditPlanTemp(List<AuditProcessValidate> auditProcessValidate);
	Object[] isValiedPlan(int legalEntityCode,String auditType,String maker); 
	String skillSetValidation(String legalEntityCode, String userId, String unitCode, String auditTypeCode);
	
	AuditPlan getAuditByPlanId(int legalEntityCode,String auditTypeCode,String planId);
	
	
	public boolean isAuditorsExist(int legalEntityCode) throws Exception ;
	public boolean isAuditParametersExist(int legalEntityCode,String auditTypeCode) throws Exception;

	List getAllUnits(int legalEntityCode, String search);
	public List<AdhocPlanFinalV> getAdhocPlan(int legalEntityCode,String auditTypeCode,String unitCode,String currBusinesDate);
	//public List<AdhocPlanFinalV> getAdhocPlan(int legalEntityCode,String auditTypeCode,String planId);
	String getAdhocUnitSheduleDetails(int legalEntityCode, String auditTypeCode, String unitCode,
			String currBusinesDate);

	Map financialYearDates(int legalEntityCode);

	Map jurisdictionByShedule(int legalEntityCode, String units, String auditTypeCode,String plnStDate,String plnEnDate);

	public String previousAuditDetails(int legalEntityCode, String auditType, String unitCode, String auditId);

	Long getOperationAuditUnits(int legalEntityCode, String auditType, String unitIds) throws Exception;
	Long getAllOperationAuditUnits(int legalEntityCode, String auditType, String unitIds) throws Exception;
	
	Long numberOfBusinessDaysBtweenStartEndDates(String legalEntityCode, String unitCode, String stDate, String enDate);
	
	public String getWatchListForAllAudits(int legalEntityCode,String auditTypeCode);

	Long getTargetAudits(int legalEntityCode, String units, String auditTypeCode, String userOrUnitCode);
	
	List<AuditProcessV> getAssessmentsByAuditType(int legalEntityCode,String auditType, String planStartDate, String planEndDate,String maker);
	
	List getRiskAssessorsTeam(int legalEntityCode,String auditType,String unitCode, String userId);
	List getRiskAssessorsTeamChekcer(int legalEntityCode,String auditType,String unitCode, String userId);
	String validateAuditInspectionProcessPreviosDate(int legalEntityCode,  String userIds, Date planStartDate);
	List<AuditTeam> immediatePrecedinginSpection(int legalEntityCode, String auditTypeCode, String planId,
			String maker, String unitId,String userIds);
	String userIsFromOtherRegion(int legalEntityCode, String auditTypeCode, String unitId,  String userIds);
	
	//String compareUserGrades(int legalEntityCode, String teamLead, String members);

	List getauditProcessPIOTeam(int legalEntityCode, String auditType, String userId);

	Map<String, String> isValiedBusinessDate(Session session,AuditProcessV apv,Date currStartDate,Date currEndDate,String frequency,Date plnStDate,Date plnEnDate);
	
	Map<String, String> getUserGradeMap(Integer legalEntityCode);
	
	boolean isAuditorsConflict(int legalEntityCode, String auditId, Date schStartDate, Date schEndDate, List<String> aioPios);
	
	boolean isUnitInspectingSametime(int legalEntityCode, String auditId, String unitId, String auditTypeCode, Date schStartDate, Date schEndDate);

	boolean isEffortMismatch(int legalEntityCode, String auditId, Date schStartDate, Date schEndDate, List<String> aioPios);
	
	boolean isAuditorsBelongstoSameOffice(int legalEntityCode, String unitId, List<String> aioPios);
	
	boolean isAuditorsBelongstoPrevAudit(int legalEntityCode, String auditId, String auditTypeCode, String unitId,  List<String> aioPios);
	
	boolean isAuditorsAvailableDuetoPrevAudit(int legalEntityCode, String auditId, String auditTypeCode, String unitId,  List<String> aioPios);
	
	List<AuditPlanV> getAuditProcessNextPlan(int legalEntityCode,String auditTypeCode, String plannerUnitCode); 
	
	List<AuditPlanWrk> isPlanAlreadyExist(int legalEntityCode,String userId,String parentUnitCode,String auditTypeCode);
	
	List<AuditProcessV> getAuditProcessByAuditPlanAtParent(int legalEntityCode,String auditType,String parentUnitCode, String planStartDate, String planEndDate,String maker);

	Map<String, String> isDateFallOnFortnight(String legalEntityCode,String unitId,String currDate);
	Map<String, String> isDateFallOnHoliday(String legalEntityCode,String unitId,String currDate);
}
