package com.bankaudit.rest.process.dao;

import java.util.List;

import org.hibernate.Session;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.bankaudit.constants.BankAuditConstant;
import com.bankaudit.dao.AbstractDao;
import com.bankaudit.process.model.AuditDocumentDetails;
import com.bankaudit.service.BusinessDateService;

@Repository("auditDocumentDetailsDao")
public class AuditDocumentDetailsDaoImpl extends AbstractDao implements AuditDocumentDetailsDao{

	@Autowired 
	BusinessDateService businessDateService;
	
	static final Logger logger = Logger.getLogger(AuditDocumentDetailsDaoImpl.class);
	
	/*@SuppressWarnings("unchecked")
	@Override
	public List<AuditDocumentDetails> getAuditDocumentDetails(Integer legalEntityCode, String auditTypeCode, String planId,
			String auditId, String userId) {
		logger.info("AuditDocumentDetailsDaoImpl getAuditDocumentDetails:: LE .. "+legalEntityCode+" planId:: "+planId +" auditId:: "+auditId );
		Session session = getSession();
		return session.createQuery("from AuditDocumentDetails where "
				+ " legalEntityCode =:legalEntityCode "
				+ " and auditTypeCode =:auditTypeCode "
				+ " and planId =:planId "
				+ " and auditId =:auditId "
				+ " and observationId ='AUDIT' "
				+ " and documentType ='AUDIT_OFFSET' "   
				+ " and status ='A' ")
		.setParameter("legalEntityCode", legalEntityCode)
		.setParameter("auditTypeCode", auditTypeCode)
		.setParameter("planId", planId)
		.setParameter("auditId", auditId).list();
	}*/
	
	/*@Override
	public String deleteAuditOffsetDocumentDetails(Integer legalEntityCode,Integer id, String auditTypeCode, String planId, String auditId ){
		
		Session session = getSession();
		String strQuery =" Update AuditDocumentDetails Set "
				+ " status = '"+BankAuditConstant.STATUS_DEL+"' "
						+ " Where id=:id "
						+ " and legalEntityCode=:legalEntityCode "
						+ " and auditTypeCode=:auditTypeCode "
						+ " and planId =:planId "
						+ " and auditId=:auditId"
						+ " and observationId ='AUDIT' "
						+ " and documentType ='AUDIT_OFFSET' ";
		
		session.createQuery(strQuery)
		.setParameter("id", id)
		.setParameter("legalEntityCode", legalEntityCode)
		.setParameter("auditTypeCode", auditTypeCode)
		.setParameter("planId", planId)
		.setParameter("auditId", auditId)
		.executeUpdate();
		return BankAuditConstant.SUCCESS;
		 
	}*/
}
