package edu.fiu.jtlex.data;

import static org.junit.jupiter.api.Assertions.*;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import org.junit.jupiter.api.Test;

import edu.fiu.jtlex.AText;
import edu.fiu.jtlex.IClause;
import edu.fiu.jtlex.ICompoundTerm;
import edu.fiu.jtlex.ILinguisticEvent;
import edu.fiu.jtlex.IRel;
import edu.fiu.jtlex.ITerm;
import edu.fiu.jtlex.LinguisticEvent;
import edu.fiu.jtlex.Rel;
import edu.fiu.jtlex.ITemporalNode;
import edu.fiu.jtlex.TemporalNode;
import edu.fiu.jtlex.Term;
import edu.fiu.jtlex.data.IInstance.Aspect;
import edu.fiu.jtlex.data.ITimex.TimexType;
import edu.fiu.jtlex.ILinguisticEvent.EventAspect;
import edu.fiu.jtlex.ILinguisticEvent.EventIntent;
import edu.fiu.jtlex.ILinguisticEvent.EventType;
import edu.fiu.jtlex.IRel.EnhancedPlusPlusDependency;
import edu.fiu.jtlex.IRel.SemanticCategory;
import edu.fiu.jtlex.IRel.SyntacticCategory;
import edu.fiu.jtlex.IRel.Type;
import edu.fiu.jtlex.ITerm.PartOfSpeech;




/**
 * 
 * @author arada002
 *
 */
class ATextTest {

	String text = "a";
	String rawText = "{a}";
	Set<ILinguisticEvent> linguisticEvents = new HashSet<ILinguisticEvent>(Arrays.asList(new LinguisticEvent(0, "lemma", "text", 2, 0, EventType.REPORT, EventIntent.ACHIEVEMENT, EventAspect.INITIATION,null, null, false, null, null)));
	Set<IRel> rels = new HashSet<IRel>(Arrays.asList(new Rel(1,Type.CONTAINS,123,123,EnhancedPlusPlusDependency.CCOMP,SemanticCategory.ACTION,SyntacticCategory.OBJECT, null)));
	Set<IClause> clauses = new HashSet<IClause>();
	Set<ICompoundTerm> compoundTerms = new HashSet<ICompoundTerm>();
	Set<IRel> emptyRels = new HashSet<IRel>();
	Term term  = new Term(388, "the", "the.00", "The past 20 months", "633", 636, 650, PartOfSpeech.CC, "1", "P20M", ITerm.NamedEntity.DURATION, "P20M", TimexType.DURATION, "2", null, Aspect.NONE);
	Term[] terms1 = new Term[] {term};
	Set<ITerm> terms = new HashSet<ITerm>(Arrays.asList(terms1));
	Set<ITemporalNode> temporalNodes = new HashSet<ITemporalNode>(Arrays.asList(new TemporalNode(1,0,5, "Hello, i would like to know you",null, null, null,null,null)));
	String emptyText = "";
	String whitespaceText = "        ";

	@Test
	void testConstructor(){
		new AText (text, rawText, linguisticEvents, temporalNodes, clauses,
				compoundTerms, terms, rels);
	}

	@Test
	void testTextNull() {
		assertThrows(NullPointerException.class, ()-> new AText (null, rawText, linguisticEvents, temporalNodes, clauses,
				compoundTerms, terms, rels));
	}
	
	@Test
	void testTextEmpty() {
		assertThrows(IllegalArgumentException.class, ()-> new AText (emptyText, rawText, linguisticEvents, temporalNodes, clauses,
				compoundTerms, terms, emptyRels));
	}
	
	@Test
	void testTextWhitespace() {
		assertThrows(IllegalArgumentException.class, ()-> new AText (whitespaceText, rawText, linguisticEvents, temporalNodes, clauses,
				compoundTerms, terms, rels));
	}
	
	@Test
	void testRawTextNull() {
		assertThrows(NullPointerException.class, ()-> new AText (text, null, linguisticEvents, temporalNodes, clauses,
				compoundTerms, terms, rels));
	}
	
	@Test
	void testRawTextEmpty() {
		assertThrows(IllegalArgumentException.class, ()-> new AText (rawText, emptyText,linguisticEvents, temporalNodes, clauses,
				compoundTerms, terms, rels));
	}
	
	@Test
	void testRawWhitespace() {
		assertThrows(IllegalArgumentException.class, ()-> new AText (rawText, whitespaceText, linguisticEvents, temporalNodes, clauses,
				compoundTerms, terms, rels));
	}
	//?
	@Test
	void testLinguisticEventsEmpty() {
		assertThrows(IllegalArgumentException.class, ()-> new AText (rawText, whitespaceText, new HashSet<>(), temporalNodes, clauses,
				compoundTerms, terms, rels));
	}
	
	/*@Test
	void testTemporalNodesEmpty() {
		assertThrows(IllegalArgumentException.class, ()-> new AText (rawText, whitespaceText, linguisticEvents, new HashSet<>(), clauses,
				compoundTerms, terms, rels));
	}*/
	//?
//	@Test
//	void testClausesEmpty() {
//		assertThrows(IllegalArgumentException.class, ()-> new AText (rawText, whitespaceText, linguisticEvents, temporalNodes, new HashSet<>(),
//				compoundTerms, terms, rels));
//	}
	
//	@Test
//	void testCompoundTermsEmpty() {
//		assertThrows(IllegalArgumentException.class, ()-> new AText (rawText, whitespaceText, linguisticEvents, temporalNodes, clauses,
//				new HashSet<>(), terms, rels));
//	}
	
	@Test
	void testTermsEmpty() {
		assertThrows(IllegalArgumentException.class, ()-> new AText (rawText, whitespaceText, linguisticEvents, temporalNodes, clauses,
				compoundTerms, new HashSet<>(), rels));
	}
	
	@Test
	void testRelsEmpty() {
		assertThrows(IllegalArgumentException.class, ()-> new AText (rawText, whitespaceText, linguisticEvents, temporalNodes, clauses,
				compoundTerms, terms, emptyRels));
	}
	
}
