package xyz.thastertyn.Scrape;

import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;

import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import xyz.thastertyn.Types.Choice;
import xyz.thastertyn.Types.Options;

public class Reports extends JecnaScrape {
	
	ArrayList<xyz.thastertyn.Types.Reports> reportList = new ArrayList<>(); 

	public void download() throws UnknownHostException, IOException
	{
		Document reportDoc = Downloader.download("https://www.spsejecna.cz/user-student/record-list");

		Elements report = reportDoc.select("ul.list li");

		for(Element e : report)
		{
			boolean isPositive = false;
			String label = "";

			Elements spans = e.select("li").select("a.item").select("span");

			isPositive = spans.get(0).hasClass("sprite-icon-tick-16");
			label = spans.get(1).select("span.label").text();

			reportList.add(new xyz.thastertyn.Types.Reports(label, isPositive));
		}
	}

	public ArrayList<xyz.thastertyn.Types.Reports> getSdeleni()
	{
		return reportList;
	}

	@Override
	public Options[] getOptions() {
		return null;
	}

	@Override
	public void download(Choice choice) throws IOException {}
}
