package cokr.xit.fims.cmmn.pdf.extraction.format;

import java.util.ArrayList;
import java.util.List;

import cokr.xit.fims.cmmn.PredefinedSet;
import cokr.xit.foundation.data.DataObject;

public abstract class PDFExtractFormat {

	protected List<PredefinedSet> predefinedSetList = new ArrayList<PredefinedSet>();

	public void appendPredefinedYn(List<DataObject> extrArtclStngList) {

		if(extrArtclStngList!=null && !extrArtclStngList.isEmpty()) {

			List<PredefinedSet> prototypeStngs = this.getPredefinedSetList();

			for(DataObject extrArtclStng : extrArtclStngList) {
				String extrArtclNm = (String) extrArtclStng.get("EXTR_ARTCL_NM");

				List<PredefinedSet> prototypeStng = prototypeStngs.stream().filter(item -> item.getArtclNm().equals(extrArtclNm)).toList();
				if(prototypeStng != null && !prototypeStng.isEmpty()) {
					extrArtclStng.set("PREDEFINED_YN", "Y");
				} else {
					extrArtclStng.set("PREDEFINED_YN", "N");
				}
			}
		}


	}

	public List<PredefinedSet> getPredefinedSetList(){
		return this.predefinedSetList;
	}
}
