/**
 * 
 */
package edu.fiu.jtlex.data;


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

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import edu.fiu.jtlex.CompoundTerm;
import edu.fiu.jtlex.ICompoundTerm;
import edu.fiu.jtlex.ICompoundTerm.Label;
import edu.fiu.jtlex.ITerm;
import edu.fiu.jtlex.ITerm.NamedEntity;
import edu.fiu.jtlex.ITerm.PartOfSpeech;
import edu.fiu.jtlex.ITerm.ATense;
import edu.fiu.jtlex.TemporalNode;
import edu.fiu.jtlex.data.IInstance.Aspect;
import edu.fiu.jtlex.data.ITimex.FunctionInDocument;
import edu.fiu.jtlex.data.ITimex.TimexMod;
import edu.fiu.jtlex.data.ITimex.TimexType;
import edu.fiu.jtlex.Term;

/**
 * @author ccaro014
 *
 */
class TemporalNodeTest {
	public int id = 1;
	public Label[] label = new Label[] {Label.TERM};
	String lemma = "Hello";
	public TimexType timexType = TimexType.DATE;
	int begin = 0;
	int end = 5;
	String text = "Hello, i would like to know you";
	public PartOfSpeech partOfSpeech = PartOfSpeech.CC;
	int elementId = 2;
	public ITerm.ATense tense = ITerm.ATense.PAST;
	public Aspect aspect = Aspect.PROGRESSIVE;
	String aspect2 = "PROGRESSIVE";
	String timexText = "Hello, i would like to know you";
	String duration = "7";
	String frameSet = "7";
	public NamedEntity namedEntity = NamedEntity.FACILITY;
	String normalizedNer = "0";
	
	
	
	public Term term = new Term(id,lemma,frameSet,text, "10", begin,end,partOfSpeech, "2",timexText,
			namedEntity, normalizedNer, timexType, "1", null, Aspect.NONE);
	//Term(int id, String lemma, String frameSet, String text, int sentenceId, int begin, int end, String pos, int elementId, String timexText,
			//NamedEntity namedEntity, String normalizedNER, TimexType timexType, int tid)
	public Term[] n = new Term[] {term};
	
	public String[] term2 = new String[] {"test","test2"};
	
	CompoundTerm[] terms;
	
	CompoundTerm compound =  new CompoundTerm(id,label,lemma,timexType,begin,end,text,partOfSpeech,elementId,tense,aspect,timexText
			,duration,term, false);
	
	public CompoundTerm[] ol = new CompoundTerm[] {compound};
	
	
	
	@Nested
	@DisplayName("Testing Constructor")
	class testTemporalNodeConstructor {
		@Nested
		@DisplayName("If Anansi Id is ")
		class TestId {
			@Test
			@DisplayName("negative")
			void testIdNegative() {
				assertThrows(IllegalArgumentException.class, ()-> new TemporalNode(-1,0,5, "Hello, i would like to know you",compound, null, null, null, null));
			
			}
			
		}
		@Nested
		@DisplayName("If Anansi begin is")
		class testBegin{
			@Test
			@DisplayName("negative")
			void testBeginNegative() {
				assertThrows(IllegalArgumentException.class, ()-> new TemporalNode(1,-1,5, "HHello, i would like to know you",compound, null, null, null, null));
			}
		}
		@Nested
		@DisplayName("If Anansi end is")
		class testEnd{
			@Test
			@DisplayName("negative")
			void testBeginNegative() {
				assertThrows(IllegalArgumentException.class, ()-> new TemporalNode(1,0,-1, "Hello, i would like to know you",compound, null, null, null, null));
			}
		}
		@Nested
		@DisplayName("If Anansi text is")
		class testText{
			@Test
			@DisplayName("null")
			void testBeginNegative() {
				assertThrows(IllegalArgumentException.class, ()-> new TemporalNode(1,-1,5, null,compound, null, null, null, null));
			}
		}
		@Nested
		@DisplayName("If Anansi compoundTerms is")
		class testTerms{
			@Test
			@DisplayName("negative")
			void testBeginNegative() {
				assertThrows(IllegalArgumentException.class, ()-> new TemporalNode(1,-1,5, "Hello, i would like to know you",null, null, null, null, null));
			}
		}
		
	}
	
	
	@Nested
	@DisplayName("Testing getters")
	class TestGetters{
		
		//Anansi id getter test
		@Nested
		@DisplayName("getId")
		class TestGetId{
			@Test
			@DisplayName("returning int")
			void testGetAnansiId() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know you",compound, null, null, null, null);
				assertEquals(Node.getId(), 1);
				}
		}
		@Nested
		@DisplayName("GetBegin")
		class TestGetBegin{
			@Test
			@DisplayName("returning int")
			void testGetAnansiBegin() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know you",compound, null, null, null, null);
				assertEquals(Node.getBegin(),0);
			}
		}
		@Nested
		@DisplayName("GetEnd")
		class TestGetEnd{
			@Test
			@DisplayName("returning int")
			void testGetAnansiEnd() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know youu",compound, null, null, null, null);
				assertEquals(Node.getEnd(),5);
			}
		}
		@Nested
		@DisplayName("GetText")
		class TestGetText{
			@Test
			@DisplayName("returning string")
			void testGetAnansiEnd() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know you",compound, null, null, null, null);
				assertEquals(Node.getText(),"Hello, i would like to know you");
			}
		}
		@Nested
		@DisplayName("GetTimexText")
		class TestGetTimextText{
			@Test
			@DisplayName("returning string")
			void testGetAnansiEnd() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know you",ol[0], null, ol[0].getTimexText(), null, null);
				assertEquals(Node.getTimexText(), ol[0].getTimexText());
			}
		}
		@Nested
		@DisplayName("GetTimexType")
		class TestGetTimexType{
			@Test
			@DisplayName("returning timexType ")
			void testGetAnansiEnd() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know you",ol[0], ol[0].getTimexType(), null, null, null);
				assertEquals(Node.getTimexType(), ol[0].getTimexType());
			}
		}
		@Nested
		@DisplayName("GetTimexTid")
		class TestGetTimexTId{
			@Test
			@DisplayName("returning int")
			void testGetAnansiEnd() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know you",compound, null, null, null, null);
				assertEquals(Node.getTimexTid(),0);
			}
		}
		@Nested
		@DisplayName("GetFid")
		class TestGetFid {
			@Test
			@DisplayName("returning Fid")
			void testGetAnansiEnd() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know you",compound, null, null, null, null);
				assertEquals(Node.getFid(),FunctionInDocument.NONE);
			}
		}
		/*@Nested
		@DisplayName("GetCompoundTerm")
		class TestGetCompoundTerm {
			@Test
			@DisplayName("returning CompoundTerm")
			void testGetAnansiEnd() {
				TemporalNode Node = new TemporalNode(1,0,5,"Hello, i would like to know you",ol);
				assertEquals(Node.getCompoundTerm(),ol[0].getTerm());
			}
		}*/
	}
}
