package edu.fiu.jtlex.data;


import org.junit.Before;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

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

//TEST has errors in it that needed to be fixed.
public class TimelineTest {
	@Test
	void testTimeline() {
		
		IGraph TimeML = testUtils.generateTestGraph(0);
		
		ArrayList<IGraph> partitions = IGraphPartitioner.partitionGraph(TimeML);
		Set<ILink> partitionLinks = IGraphPartitioner.partitionLinks();
		ArrayList<List<String>> timelines = new ArrayList<>();
		for (IGraph partitioned_graph : partitions) {
			GraphTCSP tcsp = new GraphTCSP(partitioned_graph);
			List<String> solved_timeline = tcsp.solve();//ERROR
			timelines.add(solved_timeline);
		}
				
		Timeline jtlex_timeline = new Timeline(timelines, partitionLinks);
		
		while (jtlex_timeline.hasNext()) {
			System.out.println(jtlex_timeline.next());
		}
		
		System.out.println("Main Timeline: "  + jtlex_timeline.getMainTimeline());
		System.out.println("First Point: " + jtlex_timeline.getFirstPoint());
		System.out.println("Last Point: "+ jtlex_timeline.getLastPoint());
		System.out.println("Total time points: " + jtlex_timeline.getTotalTimePoints());
		System.out.println("Total attachment points: " + jtlex_timeline.getAttachmentPoints());
		System.out.println("Timeline length: " + jtlex_timeline.getTimelineLength());
		System.out.println("Subordination Timelines: " + jtlex_timeline.getSubordinationTimelines());
		System.out.println("Subordination branches: "+ jtlex_timeline.getTotalSubordinationBranches());
		

		// The number of graphs we should obtain from partitioning the graph above is 4
	}
}
