package com.ejie.ad74a.validacion;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import com.ejie.ad74a.exceptions.Ad74aException;
import com.ejie.ad74a.exceptions.ErrorField;
import com.ejie.ad74a.exceptions.Mensaje;
import com.ejie.ad74a.exceptions.ParametroKey;
import com.ejie.ad74a.model.Ayuntamientos;
import com.ejie.ad74a.model.Iprem;
import com.ejie.ad74a.service.IpremService;
import com.ejie.ad74a.util.comun.UtilLiterales;
import com.ejie.ad74a.util.comun.UtilValidaciones;
import com.ejie.ad74a.util.comun.Utilidades;
import com.ejie.ad74a.util.constantes.Constantes;
import com.ejie.ad74a.util.constantes.FormaPagoEnum;

@Component(value = "DocuAvisosValidator")
public class DocuAvisosValidator {
	private static final Logger LOGGER = LoggerFactory.getLogger(DocuAvisosValidator.class);

	private static final String LABEL_DOCUMENTOS = "docuAvisos.documentoAdjunto";

	private static final String LABEL_TAMANO_FICHERO = "docuAvisos.documentoTamano";

	@Resource
	private ReloadableResourceBundleMessageSource appMessageSource;

	public void validate(List<ErrorField> errorFields, MultipartFile documento) throws IOException {
		DocuAvisosValidator.LOGGER.info("DocuAvisosValidator: validate ");

		if (documento.getBytes().length == 0) {
			errorFields.add(
					new ErrorField(DocuAvisosValidator.LABEL_DOCUMENTOS, DocuAvisosValidator.LABEL_TAMANO_FICHERO));

		}

	}
}
